var _ … const extraSlogSinkDepth … func (l fnlogger) Handle(_ context.Context, record slog.Record) error { … } func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { … } func (l fnlogger) WithGroup(name string) logr.SlogSink { … } // attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups // and other details of slog. func attrToKVs(attr slog.Attr, kvList []any) []any { … } // levelFromSlog adjusts the level by the logger's verbosity and negates it. // It ensures that the result is >= 0. This is necessary because the result is // passed to a LogSink and that API did not historically document whether // levels could be negative or what that meant. // // Some example usage: // // logrV0 := getMyLogger() // logrV2 := logrV0.V(2) // slogV2 := slog.New(logr.ToSlogHandler(logrV2)) // slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) // slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) // slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) func (l fnlogger) levelFromSlog(level slog.Level) int { … }