Documentation ¶
Index ¶
- Constants
- func ContextWithLogger(ctx context.Context, logger *Logger) context.Context
- type Level
- type Logger
- func (l *Logger) Debug(msg string, keysAndValues ...any)
- func (l *Logger) Error(err error, msg string, keysAndValues ...any)
- func (l *Logger) GetLogger() logr.Logger
- func (l *Logger) Info(msg string, keysAndValues ...any)
- func (l *Logger) Trace(msg string, keysAndValues ...any)
- func (l *Logger) WithValues(keysAndValues ...any) *Logger
Constants ¶
View Source
const ( ErrorLevel = Level(logrus.ErrorLevel) InfoLevel = Level(logrus.InfoLevel) DebugLevel = Level(logrus.DebugLevel) TraceLevel = Level(logrus.TraceLevel) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶ added in v0.7.0
type Logger struct {
// contains filtered or unexported fields
}
Logger is a wrapper around logr.Logger that provides a more ergonomic API. This is heavily inspired by a similar wrapper from https://github.com/kubernetes-sigs/cluster-api-provider-aws
func LoggerFromContext ¶
LoggerFromContext extracts a *Logger from the provided context.Context and returns it. If no *Logger is found, a global *Logger is returned.
func (*Logger) GetLogger ¶ added in v0.7.0
GetLogger returns the underlying logr.Logger for cases where one needs to interact with the logr API directly.
func (*Logger) WithValues ¶ added in v0.7.0
WithValues adds key-value pairs to a logger's context.
Click to show internal directories.
Click to hide internal directories.