log

package
v0.0.0-...-a5a0d7e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Log logr.Logger = dLog
)

Functions

func SetLogger

func SetLogger(logger logr.Logger)

Types

type DelegatingLogger

type DelegatingLogger struct {
	// contains filtered or unexported fields
}

DelegatingLogger is a logr.Logger that delegates to another logr.Logger. If the underlying promise is not nil, it registers calls to sub-loggers with the logging factory to be populated later, and returns a new delegating logger. It expects to have *some* logr.Logger set at all times (generally a no-op logger before the promises are fulfilled).

func NewDelegatingLogger

func NewDelegatingLogger(initial logr.Logger) *DelegatingLogger

NewDelegatingLogger constructs a new DelegatingLogger which uses the given logger before it's promise is fulfilled.

func (*DelegatingLogger) Enabled

func (l *DelegatingLogger) Enabled() bool

Enabled tests whether this Logger is enabled. For example, commandline flags might be used to set the logging verbosity and disable some info logs.

func (*DelegatingLogger) Error

func (l *DelegatingLogger) Error(err error, msg string, keysAndValues ...interface{})

Error logs an error, with the given message and key/value pairs as context. It functions similarly to calling Info with the "error" named value, but may have unique behavior, and should be preferred for logging errors (see the package documentations for more information).

The msg field should be used to add context to any underlying error, while the err field should be used to attach the actual error that triggered this log line, if present.

func (*DelegatingLogger) Fulfill

func (l *DelegatingLogger) Fulfill(actual logr.Logger)

Fulfill switches the logger over to use the actual logger provided, instead of the temporary initial one, if this method has not been previously called.

func (*DelegatingLogger) Info

func (l *DelegatingLogger) Info(msg string, keysAndValues ...interface{})

Info logs a non-error message with the given key/value pairs as context.

The msg argument should be used to add some constant description to the log line. The key/value pairs can then be used to add additional variable information. The key/value pairs should alternate string keys and arbitrary values.

func (*DelegatingLogger) V

func (l *DelegatingLogger) V(level int) logr.Logger

V returns an Logger value for a specific verbosity level, relative to this Logger. In other words, V values are additive. V higher verbosity level means a log message is less important. It's illegal to pass a log level less than zero.

func (*DelegatingLogger) WithName

func (l *DelegatingLogger) WithName(name string) logr.Logger

WithName provides a new Logger with the name appended

func (*DelegatingLogger) WithValues

func (l *DelegatingLogger) WithValues(tags ...interface{}) logr.Logger

WithValues provides a new Logger with the tags appended

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL