Documentation ¶
Overview ¶
Package clog provides a slog Handler that mimics the output of the zerolog.Logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorFieldName = "error"
ErrorFieldName is the field name used for error fields (zerolog does this).
Functions ¶
func NewHandler ¶
NewHandler returns a Handler with the default options that writes to w.
func WithColor ¶
func WithColor(c ColorOptions) func(*Handler)
WithColor is an option setting function for NewHandler. It sets the ColorOptions for the Handler.
func WithFormat ¶
func WithFormat(f FormatOptions) func(*Handler)
WithFormat is an option setting function for NewHandler. It sets the FormatOptions for the Handler.
Types ¶
type ColorOptions ¶
type ColorOptions struct { Colorer ansi.Colorer Time ansi.Color Field ansi.Color Source ansi.Color Level map[slog.Level]ansi.Color }
ColorOptions is a set of options for colorizing the output of a Handler.
type FormatOptions ¶
FormatOptions is a set of options for formatting log messages.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements an slog.Handler.
type HandlerOptions ¶
type HandlerOptions slog.HandlerOptions
HandlerOptions is a set of options for a Handler.
func (HandlerOptions) NewHandler ¶
NewHandler returns a Handler the writes to w and invokes any option setting functions.
Directories ¶
Path | Synopsis |
---|---|
Package ansi provides ANSI escape codes for setting the foreground color of text.
|
Package ansi provides ANSI escape codes for setting the foreground color of text. |
Package main provides a sample program for the clog package.
|
Package main provides a sample program for the clog package. |