Skip to content

Commit

Permalink
Slog: share the same mutex among all clones of the dev mode handler
Browse files Browse the repository at this point in the history
  • Loading branch information
System-Glitch committed Apr 11, 2024
1 parent 0c305f1 commit 69104d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions slog/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (h *DevModeHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
return &DevModeHandler{
opts: h.opts,
w: h.w,
mu: &sync.Mutex{},
mu: h.mu,
attrs: newAttrs,
groups: h.groups,
}
Expand All @@ -194,7 +194,7 @@ func (h *DevModeHandler) WithGroup(name string) slog.Handler {
return &DevModeHandler{
opts: h.opts,
w: h.w,
mu: &sync.Mutex{},
mu: h.mu,
attrs: append(make([]slog.Attr, 0, len(h.attrs)), h.attrs...),
groups: append(h.groups, name),
}
Expand Down

0 comments on commit 69104d3

Please sign in to comment.