Skip to content

Commit

Permalink
fixes incorrect WithAttrs and WithGroup behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ronny committed May 29, 2024
1 parent e86cd96 commit e3b7056
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ func (h *Handler) Enabled(ctx context.Context, level slog.Level) bool {

// WithAttrs implements [log/slog.Handler].
func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler {
h.handler = h.handler.WithAttrs(attrs)
return h
return &Handler{
opts: h.opts,
handler: h.handler.WithAttrs(attrs),
}
}

// WithGroup implements [log/slog.Handler].
func (h *Handler) WithGroup(name string) slog.Handler {
h.handler = h.handler.WithGroup(name)
return h
return &Handler{
opts: h.opts,
handler: h.handler.WithGroup(name),
}
}

0 comments on commit e3b7056

Please sign in to comment.