log

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLog

func SetLog(log logr.Logger)

SetLog sets a concrete logging implementation for all deferred Loggers.

Types

type Log

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

Log logs messages to various levels.

Based on the go-logr package.

The Log type enables various verbosity levels to be logged based on to the --zap-level argument to the operator.

To create an instance of the log named "main":

log := log.NewLog("main")

When --zap-level is not provided then the logging defaults to INFO level where log.Warning() and log.Info() are logged,

if --zap-level is set to 1 then the logging goes to the DEBUG level where log.Debug() is logged,

while the --zap-level set to 2 is reserved for a finer DEBUG-level logging provided by the log.Trace() function.

func NewLog

func NewLog(name string, keysAndValues ...interface{}) *Log

NewLog returns an instance of a Log

func (*Log) Debug

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

Debug logs the message using go-logr package on a V=1 level as DEBUG

func (*Log) Error

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

Error logs the message using go-logr package on a default level as ERROR

func (*Log) Info

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

Info logs the message using go-logr package on a default level as INFO

func (*Log) Trace

func (l *Log) Trace(msg string, keysAndValues ...interface{})

Trace logs the message using go-logr package on a V=1 level as TRACE

func (*Log) Warning

func (l *Log) Warning(msg string, keysAndValues ...interface{})

Warning logs the message using go-logr package on a default level as WARNING

func (*Log) WithName

func (l *Log) WithName(name string) *Log

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

func (*Log) WithValues

func (l *Log) WithValues(keysAndValues ...interface{}) *Log

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

Jump to

Keyboard shortcuts

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