diff --git a/core/logger/default.go b/core/logger/default.go index 62f866d..b79f104 100644 --- a/core/logger/default.go +++ b/core/logger/default.go @@ -37,11 +37,11 @@ func NewDefault(debug bool) Logger { } func (l *Default) With(fields ...zap.Field) Logger { - return l.With(fields...).(Logger) + return l.clone(l.Logger.With(fields...)) } func (l *Default) WithLazy(fields ...zap.Field) Logger { - return l.WithLazy(fields...).(Logger) + return l.clone(l.Logger.WithLazy(fields...)) } func (l *Default) ForHandler(handler any) Logger { @@ -56,6 +56,10 @@ func (l *Default) ForAccount(acc any) Logger { return l.WithLazy(zap.Any(AccountAttr, acc)) } +func (l *Default) clone(log *zap.Logger) Logger { + return &Default{Logger: log} +} + func AnyZapFields(args []interface{}) []zap.Field { fields := make([]zap.Field, len(args)) for i := 0; i < len(fields); i++ {