Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlattenedAttr ¶
FlattenedAttr is a struct that represents a flattened attribute.
This is exactly the same than slog.Attr but:
- The Key is always a string with the format "group1.group2.group3.key" (if there are 3 encapsulated groups for this key)
- The Value can't be a group (this is the interest, attributes are flattened with group prefixes in the Key)
type FlattenedAttrsCallback ¶
type FlattenedAttrsCallback func(time time.Time, level slog.Level, message string, attrs []FlattenedAttr) error
FlattenedAttrsCallback is a function that handles slog log records with flattened attributes (no group, prefixed keys with group names).
type Handler ¶
type Handler struct { *accumulator.Accumulator // contains filtered or unexported fields }
Handler is an opaque type that implements the slog.Handler interface.
type Options ¶
type Options struct { slog.HandlerOptions Callback Callback // If not nil, this callback will be used to handle the log records. FlattenedCallback FlattenedAttrsCallback // If not nil, this callback (with flattened attributes) will be used to handle the log records. StringifiedCallback StringifiedAttrsCallback // If not nil, this callback (with stringified and flattened attributes) will be used to handle the log records. }
Options is a struct that contains the options for the ExternalHandler.
type StringifiedAttr ¶
StringifiedAttr is a struct that represents a stringified slog.Attr attribute.
This is exactly the same than FlattenedAttr but the Value is resolved to a string.
func (StringifiedAttr) String ¶
func (sa StringifiedAttr) String() string
String returns the string representation of the StringifiedAttr as "key=value".
type StringifiedAttrsCallback ¶
type StringifiedAttrsCallback func(time time.Time, level slog.Level, message string, attrs []StringifiedAttr) error
StringifiedAttrsCallback is a function that handles slog log records with stringified and flattened attributes (no group, prefixed keys with group names, values resolved as strings).