Documentation ¶
Overview ¶
Package slogger implements functionality around the slog package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the slog.Logger reference the provided context.Context carries. In case the provided context.Context carries no slog.Logger reference, calling FromContext is a passthrough call to slog.Default.
func FromEnv ¶
FromEnv returns a reference to a slog.Logger that'll write records to os.Stderr with verbosity and format configured by the LOG_LEVEL & LOG_FORMAT environment variables, respectively. It's shorthand for calling FromEnvWithWriter with os.Stderr as the argument.
func FromEnvWithWriter ¶ added in v1.1.0
FromEnvWithWriter returns a reference to a slog.Logger that'll write records to the provided io.Writer with verbosity and format configured by the LOG_LEVEL & LOG_FORMAT environment variables, respectively.
func NewContext ¶
NewContext derives a context.Context from ctx that carries the provided slog.Logger reference. Callers may retrieve the reference to the provided slog.Logger by calling FromContext on the returned context.Context.
Types ¶
This section is empty.