logger

package
v0.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func New(w io.Writer, level slog.Leveler) *slog.Logger

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.

func ParseLevel

func ParseLevel(s string) (slog.Level, error)

ParseLevel converts a string to a slog.Level.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL