Documentation ¶
Overview ¶
Package pretty is a handler for slog that formats messages beautifully.
See: https://betterstack.com/community/guides/logging/logging-in-go/
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LevelConf = map[slog.Leveler]NameColor{ eslog.LevelTrace: {"TRACE", color.WhiteString}, slog.LevelDebug: {"DEBUG", color.HiWhiteString}, slog.LevelInfo: {"INFO", color.HiGreenString}, slog.LevelWarn: {"WARN", color.HiYellowString}, slog.LevelError: {"ERROR", color.HiMagentaString}, eslog.LevelFatal: {"FATAL", color.HiRedString}, }
LevelConf is a mapping of logging levels to their respective names and colors for formatting.
Functions ¶
func NewHandler ¶
func NewHandler(out io.Writer, opts *HandlerOptions) slog.Handler
NewHandler creates a new logging handler pkg/log/slog.Handler with the specified output writer and options.
Types ¶
type HandlerOptions ¶
type HandlerOptions struct { SlogOptions *slog.HandlerOptions JSON bool }
HandlerOptions contains options for configuring a logging handler.
Click to show internal directories.
Click to hide internal directories.