logger

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Log is the base logger used by kubebuilder. It delegates to another logr.Logger. You *must* call SetLogger to get any actual logging.

Functions

func GetLogger

func GetLogger(debug bool) logr.Logger

func SetLogger

func SetLogger(l logr.Logger)

SetLogger sets a concrete logging implementation for all deferred Loggers.

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 NewS2hLogger

func NewS2hLogger(initial logr.Logger) *DelegatingLogger

func (*DelegatingLogger) Debug

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

Debug implements logr.Logger

func (*DelegatingLogger) Enabled

func (l *DelegatingLogger) Enabled() bool

Enabled implements logr.InfoLogger

func (*DelegatingLogger) Error

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

Error implements logr.Logger

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, keyAndValues ...interface{})

Info implements logr.InfoLogger

func (*DelegatingLogger) Warn

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

Warn implements logr.Logger

func (*DelegatingLogger) Warnf

func (l *DelegatingLogger) Warnf(format string, args ...interface{})

Warnf prints a message with the specified format

func (*DelegatingLogger) WithName

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

WithName implements logr.Logger

func (*DelegatingLogger) WithValues

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

WithValues implements logr.Logger

type Logger

type Logger interface {
	// All Loggers implement InfoLogger.  Calling InfoLogger methods directly on
	// a Logger value is equivalent to calling them on a V(0) InfoLogger.  For
	// example, logger.Info() produces the same result as logger.V(0).Info.
	logr.InfoLogger

	// 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.
	Error(err error, msg string, keysAndValues ...interface{})

	// Debug logs a non-error message with the given key/value pairs as context.
	// It functions similarly to calling Info with verbosity level as 1.
	//
	// 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.
	Debug(msg string, keysAndValues ...interface{})

	// Warn logs a non-error message with the given key/value pairs as context.
	// It functions similarly to calling Info with verbosity level as -1.
	//
	// 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.
	Warn(msg string, keysAndValues ...interface{})

	Warnf(format string, args ...interface{})

	// WithValues adds some key-value pairs of context to a logger.
	// See Info for documentation on how key/value pairs work.
	WithValues(keysAndValues ...interface{}) Logger

	// WithName adds a new element to the logger's name.
	// Successive calls with WithName continue to append
	// suffixes to the logger's name.  It's strongly reccomended
	// that name segments contain only letters, digits, and hyphens
	// (see the package documentation for more information).
	WithName(name string) Logger
}

Logger represents the ability to log messages, both errors and not.

var S2HLog Logger

Jump to

Keyboard shortcuts

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