Documentation
¶
Index ¶
- func NewLogSink(logger *slog.Logger) logr.LogSink
- type LogSink
- func (s *LogSink) Enabled(level int) bool
- func (s *LogSink) Error(err error, msg string, keysAndValues ...interface{})
- func (s *LogSink) Info(level int, msg string, keysAndValues ...interface{})
- func (s *LogSink) Init(info logr.RuntimeInfo)
- func (s *LogSink) WithCallDepth(depth int) logr.LogSink
- func (s LogSink) WithName(name string) logr.LogSink
- func (s LogSink) WithValues(keysAndValues ...interface{}) logr.LogSink
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogSink ¶
type LogSink struct {
// contains filtered or unexported fields
}
LogSink is a logr.LogSink backed by slog.
func (*LogSink) Enabled ¶
Enabled reports whether the backend logger is enabled at the specified level. The level value should be a compatible slog level value.(e.g. slog.LevelDebug)
func (*LogSink) Init ¶
func (s *LogSink) Init(info logr.RuntimeInfo)
Init doesn't do anything because slog.Logger doesn't expose a way to set the logr.RuntimeInfo.CallDepth.
func (*LogSink) WithCallDepth ¶
WithCallDepth returns the same logr.LogSink instance because slog.Logger doesn't support a configurable call depth.
func (LogSink) WithName ¶
WithName returns a new logr.LogSink that starts a group having the given name. The keys of all attributes added to the new logr.LogSink will be qualified by the given name. (How that qualification happens depends on the [Handler.WithGroup] method of the logr.LogSink's Handler.)
func (LogSink) WithValues ¶
WithValues returns a new logr.LogSink with additional key/value pairs set.