update kubernetes dependencies to v1.25.0
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
38
vendor/k8s.io/klog/v2/contextual.go
generated
vendored
38
vendor/k8s.io/klog/v2/contextual.go
generated
vendored
@@ -34,18 +34,6 @@ import (
|
||||
// mutex locking.
|
||||
|
||||
var (
|
||||
// contextualLoggingEnabled controls whether contextual logging is
|
||||
// active. Disabling it may have some small performance benefit.
|
||||
contextualLoggingEnabled = true
|
||||
|
||||
// globalLogger is the global Logger chosen by users of klog, nil if
|
||||
// none is available.
|
||||
globalLogger *Logger
|
||||
|
||||
// globalLoggerOptions contains the options that were supplied for
|
||||
// globalLogger.
|
||||
globalLoggerOptions loggerOptions
|
||||
|
||||
// klogLogger is used as fallback for logging through the normal klog code
|
||||
// when no Logger is set.
|
||||
klogLogger logr.Logger = logr.New(&klogger{})
|
||||
@@ -81,10 +69,10 @@ func SetLogger(logger logr.Logger) {
|
||||
// routing log entries through klogr into klog and then into the actual Logger
|
||||
// backend.
|
||||
func SetLoggerWithOptions(logger logr.Logger, opts ...LoggerOption) {
|
||||
globalLogger = &logger
|
||||
globalLoggerOptions = loggerOptions{}
|
||||
logging.logger = &logger
|
||||
logging.loggerOptions = loggerOptions{}
|
||||
for _, opt := range opts {
|
||||
opt(&globalLoggerOptions)
|
||||
opt(&logging.loggerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +107,8 @@ type loggerOptions struct {
|
||||
// Modifying the logger is not thread-safe and should be done while no other
|
||||
// goroutines invoke log calls, usually during program initialization.
|
||||
func ClearLogger() {
|
||||
globalLogger = nil
|
||||
globalLoggerOptions = loggerOptions{}
|
||||
logging.logger = nil
|
||||
logging.loggerOptions = loggerOptions{}
|
||||
}
|
||||
|
||||
// EnableContextualLogging controls whether contextual logging is enabled.
|
||||
@@ -132,14 +120,14 @@ func ClearLogger() {
|
||||
//
|
||||
// This must be called during initialization before goroutines are started.
|
||||
func EnableContextualLogging(enabled bool) {
|
||||
contextualLoggingEnabled = enabled
|
||||
logging.contextualLoggingEnabled = enabled
|
||||
}
|
||||
|
||||
// FromContext retrieves a logger set by the caller or, if not set,
|
||||
// falls back to the program's global logger (a Logger instance or klog
|
||||
// itself).
|
||||
func FromContext(ctx context.Context) Logger {
|
||||
if contextualLoggingEnabled {
|
||||
if logging.contextualLoggingEnabled {
|
||||
if logger, err := logr.FromContext(ctx); err == nil {
|
||||
return logger
|
||||
}
|
||||
@@ -160,10 +148,10 @@ func TODO() Logger {
|
||||
// better receive a logger via its parameters. TODO can be used as a temporary
|
||||
// solution for such code.
|
||||
func Background() Logger {
|
||||
if globalLoggerOptions.contextualLogger {
|
||||
// Is non-nil because globalLoggerOptions.contextualLogger is
|
||||
if logging.loggerOptions.contextualLogger {
|
||||
// Is non-nil because logging.loggerOptions.contextualLogger is
|
||||
// only true if a logger was set.
|
||||
return *globalLogger
|
||||
return *logging.logger
|
||||
}
|
||||
|
||||
return klogLogger
|
||||
@@ -172,7 +160,7 @@ func Background() Logger {
|
||||
// LoggerWithValues returns logger.WithValues(...kv) when
|
||||
// contextual logging is enabled, otherwise the logger.
|
||||
func LoggerWithValues(logger Logger, kv ...interface{}) Logger {
|
||||
if contextualLoggingEnabled {
|
||||
if logging.contextualLoggingEnabled {
|
||||
return logger.WithValues(kv...)
|
||||
}
|
||||
return logger
|
||||
@@ -181,7 +169,7 @@ func LoggerWithValues(logger Logger, kv ...interface{}) Logger {
|
||||
// LoggerWithName returns logger.WithName(name) when contextual logging is
|
||||
// enabled, otherwise the logger.
|
||||
func LoggerWithName(logger Logger, name string) Logger {
|
||||
if contextualLoggingEnabled {
|
||||
if logging.contextualLoggingEnabled {
|
||||
return logger.WithName(name)
|
||||
}
|
||||
return logger
|
||||
@@ -190,7 +178,7 @@ func LoggerWithName(logger Logger, name string) Logger {
|
||||
// NewContext returns logr.NewContext(ctx, logger) when
|
||||
// contextual logging is enabled, otherwise ctx.
|
||||
func NewContext(ctx context.Context, logger Logger) context.Context {
|
||||
if contextualLoggingEnabled {
|
||||
if logging.contextualLoggingEnabled {
|
||||
return logr.NewContext(ctx, logger)
|
||||
}
|
||||
return ctx
|
||||
|
Reference in New Issue
Block a user