Merge pull request #164 from unistack-org/logger-clone-fix

logger: fix Clone
This commit is contained in:
Василий Толстов 2023-01-06 22:44:26 +03:00 committed by GitHub
commit 0d63723ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ func (l *defaultLogger) Clone(opts ...Option) Logger {
oldopts.Wrappers = newopts.Wrappers
l.Lock()
cl := &defaultLogger{opts: oldopts, logFunc: l.logFunc, logfFunc: l.logfFunc}
cl := &defaultLogger{opts: oldopts, logFunc: l.logFunc, logfFunc: l.logfFunc, enc: json.NewEncoder(l.opts.Out)}
l.Unlock()
// wrap the Log func

View File

@ -86,12 +86,12 @@ func TestTaggedNested(t *testing.T) {
unk string
}
type str struct {
key string `logger:"omit"`
val *val `logger:"take"`
key string `logger:"omit"`
}
var iface interface{}
v := &str{val: &val{key: "test", unk: "unk"}}
v := &str{key: "omit", val: &val{key: "test", val: "omit", unk: "unk"}}
iface = v
buf := fmt.Sprintf("%#v", Unwrap(iface, Tagged(true)))
if strings.Compare(buf, `&unwrap.str{val:(*unwrap.val){key:"test"}}`) != 0 {