Documentation
¶
Overview ¶
Package logging provides a structured logger built on log/slog. It is configured once at startup via New and distributed through context values using WithLogger / FromContext.
Environment variables:
LOG_LEVEL = debug | info | warn | error (default: info) LOG_FORMAT = json | text (default: json)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the *slog.Logger stored in ctx. If no logger is present it returns slog.Default so callers never need to nil-check.
func New ¶
New constructs a *slog.Logger from environment variables. LOG_FORMAT selects the handler (json for production, text for local dev). LOG_LEVEL sets the minimum severity level.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.