We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The new slog library provides a slog.LogValuer interface for formatting attributes.
slog.LogValuer
Documentation here: https://pkg.go.dev/golang.org/x/exp/slog#hdr-Customizing_a_type_s_logging_behavior
I think palantir/stacktrace should implement it.
type customError struct { ... } func (e customError) Error() string { ... } // implements slog.LogValuer func (e customError) LogValue() slog.Value { return slog.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
slog
golang.org/x/exp/slog
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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 palantir/stacktrace should implement it.
slog
will be released in go 1.21. But is already available andgolang.org/x/exp/slog
The text was updated successfully, but these errors were encountered: