Documentation ¶
Overview ¶
Package logger is almost copy/paste from tint Handler but with some modificatoins
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ShowSQLEvents = false
Functions ¶
func Err ¶
Err returns a tinted (colorized) slog.Attr that will be written in red color by the [tint.Handler]. When used with any other slog.Handler, it behaves as
slog.Any("err", err)
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements a slog.Handler.
func NewHandler ¶
NewHandler creates a slog.Handler that writes tinted logs to Writer w, using the default options. If opts is nil, the default options are used.
type Options ¶
type Options struct { // Enable source code location (Default: false) AddSource bool // Minimum level to log (Default: slog.LevelInfo) Level slog.Leveler // ReplaceAttr is called to rewrite each non-group attribute before it is logged. // See https://pkg.go.dev/log/slog#HandlerOptions for details. ReplaceAttr func(groups []string, attr slog.Attr) slog.Attr }
Options for a slog.Handler that writes tinted logs. A zero Options consists entirely of default values.
Options can be used as a drop-in replacement for slog.HandlerOptions.
Click to show internal directories.
Click to hide internal directories.