Merge pull request 'fix clone' (#114) from cloenfix into v3
Some checks failed
build / test (push) Failing after 1m28s
build / lint (push) Failing after 2m41s
codeql / analyze (go) (push) Failing after 2m44s

Reviewed-on: #114
This commit is contained in:
Василий Толстов 2023-11-03 16:17:59 +03:00
commit b91363711d

View File

@ -29,11 +29,13 @@ func (l *zeroLogger) Level(lvl logger.Level) {
} }
func (l *zeroLogger) Clone(opts ...logger.Option) logger.Logger { func (l *zeroLogger) Clone(opts ...logger.Option) logger.Logger {
nl := &zeroLogger{zLog: l.zLog, opts: l.opts} options := l.opts
fields := options.Fields
for _, o := range opts { for _, o := range opts {
o(&nl.opts.Options) o(&options.Options)
} }
nl.opts.Options.Fields = append(l.opts.Options.Fields, nl.opts.Options.Fields...) options.Fields = append(fields, options.Fields...)
nl := &zeroLogger{opts: options}
_ = nl.Init() _ = nl.Init()
return nl return nl
} }