Skip to content

Commit

Permalink
WIP: sync klog verbosity with logger
Browse files Browse the repository at this point in the history
  • Loading branch information
pohly committed Jun 10, 2024
1 parent 007e661 commit 6898bc3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions contextual.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ func SetLoggerWithOptions(logger logr.Logger, opts ...LoggerOption) {
}

// ContextualLogger determines whether the logger passed to
// SetLoggerWithOptions may also get called directly. Such a logger cannot rely
// on verbosity checking in klog.
// SetLoggerWithOptions may also get called directly. Such a logger
// may get called in two ways:
// - directly by application code
// - indirectly by klog when application code uses klog logging methods
//
// Verbosity checking in the first case must be handled by the logger.
// In the second case, klog does its own verbosity checking.
//
// This implies that verbosity settings of the logger and of klog must
// be kept consistent.
func ContextualLogger(enabled bool) LoggerOption {
return func(o *loggerOptions) {
o.contextualLogger = enabled
Expand Down

0 comments on commit 6898bc3

Please sign in to comment.