place attribute on handler

This commit is contained in:
Jay
2026-05-21 17:02:07 -04:00
parent f144a2a724
commit a721eabd48
+2 -2
View File
@@ -95,7 +95,6 @@ func NewWorker(
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,
config: config, config: config,
handler: handler,
processedCount: &atomic.Uint64{}, processedCount: &atomic.Uint64{},
outgoingCount: &atomic.Uint64{}, outgoingCount: &atomic.Uint64{},
@@ -104,7 +103,8 @@ func NewWorker(
if handler != nil { if handler != nil {
comp := component.FromContext(ctx) comp := component.FromContext(ctx)
w.logger = slog.New(handler).With(slog.Any("component", comp), slog.String("peer_id", id)) w.handler = handler.WithAttrs([]slog.Attr{slog.String("peer", id)})
w.logger = slog.New(w.handler).With(slog.Any("component", comp))
} }
return w, nil return w, nil