Skip to content

Commit

Permalink
logs: add logger.V(5).Info example
Browse files Browse the repository at this point in the history
This is relevant for unit tests where normally such output would be shown
when using ktesting.
  • Loading branch information
pohly committed Jan 25, 2023
1 parent 0a38a5e commit 74885d1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions staging/src/k8s.io/component-base/logs/example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func Run(ctx context.Context) {
klog.TODO().Info("Now the default logger is set, but using the one from the context is still better.")

logger := klog.FromContext(ctx)
logger.V(5).Info("Log less important message at V=5 through context")

// This intentionally uses the same key/value multiple times. Only the
// second example could be detected via static code analysis.
Expand Down

0 comments on commit 74885d1

Please sign in to comment.