From a721eabd482a37189a23113ae9f238a3333c3431 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 21 May 2026 17:02:07 -0400 Subject: [PATCH] place attribute on handler --- worker.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/worker.go b/worker.go index ccec13f..24b207c 100644 --- a/worker.go +++ b/worker.go @@ -92,10 +92,9 @@ func NewWorker( sendHeartbeat: make(chan struct{}), - ctx: ctx, - cancel: cancel, - config: config, - handler: handler, + ctx: ctx, + cancel: cancel, + config: config, processedCount: &atomic.Uint64{}, outgoingCount: &atomic.Uint64{}, @@ -104,7 +103,8 @@ func NewWorker( if handler != nil { 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