Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Logger ¶
func Logger(opts ...LoggerOptionsFunc) *slog.Logger
Logger creates a new slog.Logger with the specified options
Types ¶
type ContextKey ¶ added in v1.1.0
type ContextKey string
ContextKey is the type used for context keys in the alog package
const LogAttrKey ContextKey = "alog_attributes"
LogAttrKey is the context key used to store log attributes
type LoggerOptions ¶
LoggerOptions holds configuration for creating a new logger
type LoggerOptionsFunc ¶
type LoggerOptionsFunc func(*LoggerOptions)
LoggerOptionsFunc is a function that modifies LoggerOptions
func WithAttrs ¶
func WithAttrs(attrs ...slog.Attr) LoggerOptionsFunc
WithAttrs adds default attributes to the logger
func WithLevel ¶
func WithLevel(l slog.Level) LoggerOptionsFunc
WithLevel sets the minimum log level
func WithOutput ¶
func WithOutput(w io.Writer) LoggerOptionsFunc
WithOutput sets the output writer for the logger
func WithSource ¶
func WithSource(b bool) LoggerOptionsFunc
WithSource enables or disables source code location in logs
Click to show internal directories.
Click to hide internal directories.