Documentation
¶
Overview ¶
Package level is a thin compatibility wrapper that mimics common go-kit/log/level usage patterns while delegating to the Go standard library's log/slog package.
It enables transitional code like: level.Info(logger).Log("msg", "hello", "k", 1) to continue working while using slog levels and structured attributes under the hood.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
Logger is compatible with the minimal subset of the go-kit Logger interface that is used together with go-kit/log/level: a Log method accepting keyvals.
The Log method accepts alternating key/value pairs (like slog and go-kit). Non-string keys are ignored. If a key "msg" with a string value is present, it will be used as the record message; otherwise a level-specific default is used. The remaining pairs are emitted as structured attributes via slog. An odd trailing key without value is ignored.
Example:
level.Warn(slogLogger).Log("msg", "deprecated", "feature", "x")
level.Debug(slogLogger).Log("k", 1, "x", 2) // message defaults to "debug"
Note: The emitted level is provided by slog and shouldn't be redundantly stored as an attribute named "level".
This package is intended for migration only. Prefer direct slog use over time.