From d4348c68b0000a93dbc48ac0a59a807739295ae3 Mon Sep 17 00:00:00 2001 From: Soulou Date: Tue, 10 Dec 2024 18:22:41 +0100 Subject: [PATCH] Use github.com/Scalingo/go-utils/logger API instead of injecting logger manually in context Fixes #1023 --- nsqconsumer/CHANGELOG.md | 2 ++ nsqconsumer/consumer.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nsqconsumer/CHANGELOG.md b/nsqconsumer/CHANGELOG.md index e77ce0ae..da2c1388 100644 --- a/nsqconsumer/CHANGELOG.md +++ b/nsqconsumer/CHANGELOG.md @@ -2,6 +2,8 @@ ## To be Released +* fix: Use API for github.com/go-utils/logger instead of setting logger manually in context + ## v1.3.0 * feat: add a configurable log level diff --git a/nsqconsumer/consumer.go b/nsqconsumer/consumer.go index 6140e575..803cf88c 100644 --- a/nsqconsumer/consumer.go +++ b/nsqconsumer/consumer.go @@ -266,7 +266,7 @@ func (c *nsqConsumer) nsqHandler(message *nsq.Message) (err error) { // Ignore linter here due to the usage of string as keys in context. //nolint:staticcheck,revive - ctx := context.WithValue(context.WithValue(context.Background(), "request_id", msg.RequestID), "logger", msgLogger) + ctx := logger.ToCtx(context.WithValue(context.Background(), "request_id", msg.RequestID), msgLogger) if msg.At != 0 { now := time.Now().Unix()