From fcc9dcc488034bff1d42fe49ae9af4403bcafabb Mon Sep 17 00:00:00 2001 From: Owen Cabalceta Date: Thu, 10 Nov 2022 14:44:21 -0500 Subject: [PATCH 1/2] patch --- basculehttp/log.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basculehttp/log.go b/basculehttp/log.go index 038e904..b923e98 100644 --- a/basculehttp/log.go +++ b/basculehttp/log.go @@ -85,7 +85,7 @@ func SetLogger(logger *zap.Logger) alice.Constructor { source = host } - logger = logger.With( + l := logger.With( zap.Reflect("request.Headers", sanitizeHeaders(r.Header)), //lgtm [go/clear-text-logging] zap.String("request.URL", r.URL.EscapedPath()), zap.String("request.method", r.Method), @@ -96,12 +96,12 @@ func SetLogger(logger *zap.Logger) alice.Constructor { ) traceID, spanID, ok := candlelight.ExtractTraceInfo(r.Context()) if ok { - logger = logger.With( + l = l.With( zap.String(candlelight.TraceIdLogKeyName, traceID), zap.String(candlelight.SpanIDLogKeyName, spanID), ) } - r = r.WithContext(sallust.With(r.Context(), logger)) + r = r.WithContext(sallust.With(r.Context(), l)) delegate.ServeHTTP(w, r) }) } From 595dca861db7a839eb98b0df28a928dc47f69bd2 Mon Sep 17 00:00:00 2001 From: Owen Cabalceta Date: Thu, 10 Nov 2022 17:34:46 -0500 Subject: [PATCH 2/2] based on pr feedback --- basculehttp/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basculehttp/log.go b/basculehttp/log.go index b923e98..f00d9ee 100644 --- a/basculehttp/log.go +++ b/basculehttp/log.go @@ -88,7 +88,7 @@ func SetLogger(logger *zap.Logger) alice.Constructor { l := logger.With( zap.Reflect("request.Headers", sanitizeHeaders(r.Header)), //lgtm [go/clear-text-logging] zap.String("request.URL", r.URL.EscapedPath()), - zap.String("request.method", r.Method), + zap.String("request.Method", r.Method), zap.String("request.address", source), zap.String("request.path", r.URL.Path), zap.String("request.query", r.URL.RawQuery),