diff --git a/interceptors/logging/examples/logr/example_test.go b/interceptors/logging/examples/logr/example_test.go index 1b1701bc2..8f1bf89d3 100644 --- a/interceptors/logging/examples/logr/example_test.go +++ b/interceptors/logging/examples/logr/example_test.go @@ -25,7 +25,7 @@ const ( // This code is simple enough to be copied and not imported. func InterceptorLogger(l logr.Logger) logging.Logger { return logging.LoggerFunc(func(_ context.Context, lvl logging.Level, msg string, fields ...any) { - l = l.WithValues(fields...) + l := l.WithValues(fields...) switch lvl { case logging.LevelDebug: l.V(debugVerbosity).Info(msg) diff --git a/interceptors/logging/examples/logrus/example_test.go b/interceptors/logging/examples/logrus/example_test.go index beb8ad843..d0f232f8a 100644 --- a/interceptors/logging/examples/logrus/example_test.go +++ b/interceptors/logging/examples/logrus/example_test.go @@ -22,7 +22,7 @@ func InterceptorLogger(l logrus.FieldLogger) logging.Logger { k, v := i.At() f[k] = v } - l = l.WithFields(f) + l := l.WithFields(f) switch lvl { case logging.LevelDebug: diff --git a/interceptors/logging/examples/zap/example_test.go b/interceptors/logging/examples/zap/example_test.go index f0568f5cf..fd3041751 100644 --- a/interceptors/logging/examples/zap/example_test.go +++ b/interceptors/logging/examples/zap/example_test.go @@ -17,7 +17,7 @@ import ( func InterceptorLogger(l *zap.Logger) logging.Logger { return logging.LoggerFunc(func(ctx context.Context, lvl logging.Level, msg string, fields ...any) { f := make([]zap.Field, 0, len(fields)/2) - + for i := 0; i < len(fields); i += 2 { key := fields[i] value := fields[i+1] @@ -33,9 +33,8 @@ func InterceptorLogger(l *zap.Logger) logging.Logger { f = append(f, zap.Any(key.(string), v)) } } - - - logger = l.WithOptions(zap.AddCallerSkip(1)).With(f...) + + logger := l.WithOptions(zap.AddCallerSkip(1)).With(f...) switch lvl { case logging.LevelDebug: