logr

package module
v0.0.0-...-431bcb6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(l logr.Logger) (log.Logger, bool)

GetLogger retrieves the underlying log.Logger. If no Logger is found, a Logger scoped to 'logr' is returned. The second return value can be checked if such a Logger was created.

func New

func New(l log.Logger) logr.Logger

New instantiates a new logr.Logger that sends entries to the given log.Logger.

Types

type LogSink

type LogSink struct{ log.Logger }

LogSink implements logr.LogSink, backed by a sourcegraph/log.Logger.

func (LogSink) Enabled

func (s LogSink) Enabled(level int) bool

Enabled tests whether this LogSink is enabled at the specified V-level. For example, commandline flags might be used to set the logging verbosity and disable some info logs.

func (LogSink) Error

func (s LogSink) Error(err error, msg string, keysAndValues ...any)

Error logs an error, with the given message and key/value pairs as context. See Logger.Error for more details.

func (LogSink) Info

func (s LogSink) Info(level int, msg string, keysAndValues ...any)

Info logs a non-error message with the given key/value pairs as context. The level argument is provided for optional logging. This method will only be called when Enabled(level) is true. See Logger.Info for more details.

func (*LogSink) Init

func (s *LogSink) Init(info logr.RuntimeInfo)

Init receives optional information about the logr library for LogSink implementations that need it.

func (LogSink) WithName

func (s LogSink) WithName(name string) logr.LogSink

WithName returns a new LogSink with the specified name appended. See Logger.WithName for more details.

func (LogSink) WithValues

func (s LogSink) WithValues(keysAndValues ...any) logr.LogSink

WithValues returns a new LogSink with additional key/value pairs. See Logger.WithValues for more details.

Jump to

Keyboard shortcuts

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