From 587ee64b0b59cff697b89748a71fcd04b9e29d15 Mon Sep 17 00:00:00 2001 From: Paul Wells Date: Thu, 3 Oct 2024 23:59:00 -0700 Subject: [PATCH] fix logger value passing --- logger/logger.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/logger/logger.go b/logger/logger.go index 73a24b3e..4e6042e7 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -105,28 +105,24 @@ type UnlikelyLogger struct { keysAndValues []any } -func makeUnlikelyLogger(logger Logger, keysAndValues ...any) UnlikelyLogger { - return UnlikelyLogger{logger, keysAndValues} -} - func (l UnlikelyLogger) Debugw(msg string, keysAndValues ...any) { - l.logger.Debugw(msg, slices.Concat(l.keysAndValues, keysAndValues)) + l.logger.Debugw(msg, slices.Concat(l.keysAndValues, keysAndValues)...) } func (l UnlikelyLogger) Infow(msg string, keysAndValues ...any) { - l.logger.Infow(msg, slices.Concat(l.keysAndValues, keysAndValues)) + l.logger.Infow(msg, slices.Concat(l.keysAndValues, keysAndValues)...) } func (l UnlikelyLogger) Warnw(msg string, err error, keysAndValues ...any) { - l.logger.Warnw(msg, err, slices.Concat(l.keysAndValues, keysAndValues)) + l.logger.Warnw(msg, err, slices.Concat(l.keysAndValues, keysAndValues)...) } func (l UnlikelyLogger) Errorw(msg string, err error, keysAndValues ...any) { - l.logger.Errorw(msg, err, slices.Concat(l.keysAndValues, keysAndValues)) + l.logger.Errorw(msg, err, slices.Concat(l.keysAndValues, keysAndValues)...) } func (l UnlikelyLogger) WithValues(keysAndValues ...any) UnlikelyLogger { - return makeUnlikelyLogger(l.logger, slices.Concat(l.keysAndValues, keysAndValues)) + return UnlikelyLogger{l.logger, slices.Concat(l.keysAndValues, keysAndValues)} } type sharedConfig struct { @@ -363,7 +359,7 @@ func (l *zapLogger[T]) WithValues(keysAndValues ...any) Logger { } func (l *zapLogger[T]) WithUnlikelyValues(keysAndValues ...any) UnlikelyLogger { - return makeUnlikelyLogger(l, keysAndValues) + return UnlikelyLogger{l, keysAndValues} } func (l *zapLogger[T]) WithName(name string) Logger { @@ -452,7 +448,7 @@ func (l LogRLogger) WithValues(keysAndValues ...any) Logger { } func (l LogRLogger) WithUnlikelyValues(keysAndValues ...any) UnlikelyLogger { - return makeUnlikelyLogger(l, keysAndValues) + return UnlikelyLogger{l, keysAndValues} } func (l LogRLogger) WithName(name string) Logger {