log

package
v0.0.0-...-f33f640 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctx

func Ctx(ctx context.Context) logr.Logger

Ctx returns the logger from context.

func Error

func 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 FromContext

func FromContext(ctx context.Context) logr.Logger

FromContext returns the logger from context.

func Info

func 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 Logger

func Logger() logr.Logger

Logger return the default logger.

func V

func 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 WithContext

func WithContext(parent context.Context, logger logr.Logger) context.Context

WithContext returns a copy of parent in which the logger value is set

func WithName

func WithName(name string) logr.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 recommended that name segments contain only letters, digits, and hyphens (see the package documentation for more information).

func WithValues

func WithValues(keysAndValues ...interface{}) logr.Logger

WithValues adds some key-value pairs of context to a logger. See Info for documentation on how key/value pairs work.

Types

This section is empty.

Jump to

Keyboard shortcuts

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