Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Logger = slog.Default()
Functions ¶
func NewHandler ¶ added in v1.28.0
Types ¶
type Handler ¶ added in v1.28.0
type Handler struct {
// contains filtered or unexported fields
}
type Option ¶ added in v1.28.0
type Option func(*handlerOpts)
func Delimiter ¶ added in v1.28.0
Delimiter sets the delimiter between attributes in the output. The default is a single dot.
func JSON ¶ added in v1.28.0
func JSON() Option
JSON configures the handler to output JSON instead of a human-readable format.
func Leveler ¶ added in v1.28.0
Leveler sets the log level for the handler using a slog.Leveler. This allows the log level to be changed at runtime. The default is slog.LevelInfo.
func SourceTrimTo ¶ added in v1.28.0
SourceTrimTo sets the directory in the source path to trim up to, including a tailing '/'. e.g. if the source path is "/home/user/project/pkg/file.go" and the anchor is "project", the resulting source path in the log will be "pkg/file.go".
func TimeFormat ¶ added in v1.28.0
TimeFormat sets the time format for time attributes. The default is "2006-01-02T15:04:05.000Z07:00". The format should be a valid Go time format string.