Skip to content

Commit 09a829e

Browse files
authored
fix: clone attributes for each handler (#9)
1 parent 6b19c4e commit 09a829e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

multi.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"log/slog"
7+
"slices"
78

89
"github.com/samber/lo"
910
)
@@ -50,7 +51,7 @@ func (h *FanoutHandler) Handle(ctx context.Context, r slog.Record) error {
5051
// Implements slog.Handler
5152
func (h *FanoutHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
5253
handers := lo.Map(h.handlers, func(h slog.Handler, _ int) slog.Handler {
53-
return h.WithAttrs(attrs)
54+
return h.WithAttrs(slices.Clone(attrs))
5455
})
5556
return Fanout(handers...)
5657
}

0 commit comments

Comments
 (0)