Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidLevel = errors.New("invalid log level")
Functions ¶
func Bind ¶
Bind ensures s has a logger writing to s.ErrOut at level, returning the updated copy. It is order-independent and safe to call repeatedly: a logger we created is re-leveled in place (last Bind wins), while a caller-supplied one (WithLogger) is honored and its level left untouched. level is validated upstream; unparseable values fall back to info.
func New ¶
New creates a new *slog.Logger that writes to w using console-slog for human-friendly colored output, unified with Zarf's log format. Passing a *slog.LevelVar as level allows the level to be changed at runtime.
A nil w is treated as io.Discard so callers that pass an unset IOStreams.ErrOut get a no-op logger rather than a panic. Output is never redirected to a global stream (e.g. os.Stderr); no sink means no output.
Types ¶
This section is empty.