Skip to content

Commit

Permalink
Log attrs
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Mar 5, 2024
1 parent d151e02 commit 2fc165a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/rig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ func (h *TestLogHandler) Handle(_ context.Context, r slog.Record) error {
buf.WriteString(r.Level.String())
buf.WriteByte(' ')
buf.WriteString(r.Message)
r.Attrs(func(a slog.Attr) bool {
buf.WriteByte(' ')
buf.WriteString(a.Key)
buf.WriteByte('=')
buf.WriteString(fmt.Sprintf("%v", a.Value))
return true
})
h.T.Log(buf.String())
return nil
}
Expand Down

0 comments on commit 2fc165a

Please sign in to comment.