Documentation
¶
Overview ¶
Package logger is common logging functionality to use slog
Index ¶
- func Error(log *slog.Logger, err error, msg string, args ...any)
- func ErrorContext(ctx context.Context, log *slog.Logger, err error, msg string, args ...any)
- func FromContext(ctx context.Context) *slog.Logger
- func NewContext(ctx context.Context, logger *slog.Logger) context.Context
- func NewLevelAdjustedHandler(handler slog.Handler, bias int) slog.Handler
- func V(log *slog.Logger, bias int) *slog.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorContext ¶
ErrorContext is a helper to log an error. The record is always logged.
func FromContext ¶
FromContext returns the logger stored in the context. If a logger is not found, the default logger will be returned
func NewContext ¶
NewContext wraps the given logger in the given context so that it may be retrieved with FromContext
func NewLevelAdjustedHandler ¶
NewLevelAdjustedHandler wraps the handler to perform logging at the adjusted level. The bias value is positive decrease chattiness, e.g., by making Info log entries silent unless verbosity has been upgraded.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.