mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-21 12:46:03 +03:00
fix stack overflow
This commit is contained in:
parent
3afa198be2
commit
aead3854e1
@ -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++ {
|
||||
|
Loading…
Reference in New Issue
Block a user