- Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
The new slog library provides a slog.LogValuer interface for formatting attributes.
Documentation here: https://pkg.go.dev/golang.org/x/exp/slog#hdr-Customizing_a_type_s_logging_behavior
I think cockroachdb/errors should implement it.
typecustomErrorstruct{... } func (ecustomError) Error() string{... } // implements slog.LogValuerfunc (ecustomError) LogValue() slog.Value{returnslog.GroupValue( slog.Int("code", e.code), slog.String("message", e.msg), slog.String("stacktrace", e.stacktrace), ) }slog will be released in go 1.21. But is already available and golang.org/x/exp/slog
ipfans, nozo-moto, ionutRD, hirasawayuki, nicholasbraun and 1 more
Metadata
Metadata
Assignees
Labels
No labels