place attribute on handler
This commit is contained in:
@@ -92,10 +92,9 @@ func NewWorker(
|
|||||||
|
|
||||||
sendHeartbeat: make(chan struct{}),
|
sendHeartbeat: make(chan struct{}),
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user