Skip to content

Commit

Permalink
Add LogValue method for structured logging
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mizutani committed Jan 6, 2025
1 parent 50722e8 commit 62f0e4a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ func (x *Error) Values() map[string]any {
return values
}

// LogValue returns slog.Value for structured logging. It's implementation of slog.LogValuer.
// https://pkg.go.dev/log/slog#LogValuer
func (x *Error) LogValue() slog.Value {
if x == nil {
return slog.AnyValue(nil)
Expand Down

0 comments on commit 62f0e4a

Please sign in to comment.