From 4b742c9cd78b54dc1523ac9f538c7c289d375f7e Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 3 Nov 2023 16:17:32 +0300 Subject: [PATCH] fix clone Signed-off-by: Vasiliy Tolstov --- zerolog.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zerolog.go b/zerolog.go index 7ecd2d6..29a5bc6 100644 --- a/zerolog.go +++ b/zerolog.go @@ -29,11 +29,13 @@ func (l *zeroLogger) Level(lvl logger.Level) { } 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 { - 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() return nl } -- 2.45.2