forked from go-logr/zapr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
numeric verbosity and configurable logger behavior
This is needed to make zapr usable for Kubernetes. Currently Kubernetes uses a forked zapr with "v" for the numeric verbosity and "err" for Logger.Error. Handling of invalid calls remains compatible with zapr v1.0.0 (= panic log messages are emitted, strongly-type Zap fields are not allowed), but new options allow changing those defaults. Those panic messages now log the source code of the caller, not the zapr.go file where the panic message is logged. The unit tests were derived from https://github.com/kubernetes/kubernetes/blob/cff40a7bcc170c473c223081fd0103fd042dc44b/staging/src/k8s.io/component-base/logs/json/json_test.go and both modified (better error messages, t.Run for each test case) and extended to enhance coverage. Several new edge cases are now covered (for example, error logging at non-zero verbosity levels). New tests for WithName, WithCallDepth and WithValues were added. In terms of code coverage, all functions are covered 100% except for Underlier which currently cannot be called (go-logr/logr#63).
- Loading branch information
Showing
6 changed files
with
547 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.