Documentation
¶
Overview ¶
Package logger configures a slog logger for the github-metrics project.
The exported New function returns a slog.Logger whose handler enriches log records with context-bound attributes (currently the GitHub login set via ctxutil.WithLogin). The default output format is JSON; switch to text via Options.Format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseLevel ¶
ParseLevel maps a string ("debug" / "info" / "warn" / "error") to the corresponding slog.Level. Unknown values fall back to slog.LevelInfo.
func SetDefault ¶
SetDefault installs a logger built from opts as the global slog default. It returns the installed logger for convenience.
Types ¶
type Options ¶
type Options struct {
// Format selects JSON (default) or text output.
Format Format
// Level sets the minimum record level. Zero value is slog.LevelInfo.
Level slog.Level
// Writer is the destination. Defaults to os.Stderr when nil.
Writer io.Writer
}
Options configures a logger constructed by New.