Documentation
¶
Overview ¶
Package logger provides structured JSON logging via log/slog with level-based stdout/stderr routing and context propagation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogger ¶
GetLogger returns the central singleton logger. ctx is the reserved correlation seam (per-context attributes ride it the day chinit grows request-scoped logging); nil is accepted and reads as context.Background(). The singleton is never nil: package init installs the default handler.
func Init ¶
func Init()
Init installs the process-wide singleton over the REAL stdout and stderr (JSON records, level-split). Idempotent and re-callable: Main installs it at entry, and specs re-call it to restore the default after SetLogHandler swaps in a capture buffer.
func IsDebugEnabled ¶
func IsDebugEnabled() bool
IsDebugEnabled reports whether Debug records pass the filter.
func NewLevelSplitHandler ¶
NewLevelSplitHandler builds the routing handler over two underlying JSON handlers (info → out, warn+ → err), both at LevelDebug so the route decision and the levelVar are the only filters.
func SetLogHandler ¶
SetLogHandler replaces the singleton's handler — the one configuration seam. The new logger also becomes slog.Default so a stray package-level slog call can never bypass the singleton.
func SetLogLevel ¶
SetLogLevel sets the process-wide minimum record level (Debug unlocks the chatty internals the Info default keeps out of the journal).
Types ¶
This section is empty.