diff --git a/logger.go b/logger.go index bdac9a5..13512a2 100644 --- a/logger.go +++ b/logger.go @@ -67,7 +67,7 @@ type logger struct { slowThreshold time.Duration logLevel map[LogType]slog.Level gormLevel gormlogger.LogLevel - contextKeys map[string]string + contextKeys map[string]any sourceField string errorField string diff --git a/options.go b/options.go index 1661c9d..857af6d 100644 --- a/options.go +++ b/options.go @@ -75,10 +75,10 @@ func WithIgnoreTrace() Option { } // WithContextValue adds a context value to the log -func WithContextValue(slogAttrName, contextKey string) Option { +func WithContextValue(slogAttrName string, contextKey any) Option { return func(l *logger) { if l.contextKeys == nil { - l.contextKeys = make(map[string]string, 0) + l.contextKeys = make(map[string]any, 0) } l.contextKeys[slogAttrName] = contextKey } diff --git a/options_test.go b/options_test.go index 1eac272..e706725 100644 --- a/options_test.go +++ b/options_test.go @@ -111,5 +111,5 @@ func TestWithContextValue(t *testing.T) { WithContextValue(attrName, expected)(actual) - assert.Equal(t, map[string]string{attrName: expected}, actual.contextKeys) + assert.Equal(t, map[string]any{attrName: expected}, actual.contextKeys) }