Skip to content

Commit

Permalink
Merge pull request #164 from unistack-org/logger-clone-fix
Browse files Browse the repository at this point in the history
logger: fix Clone
  • Loading branch information
vtolstov authored Jan 6, 2023
2 parents c209892 + a7f84e0 commit 0d63723
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion logger/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions logger/unwrap/unwrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0d63723

Please sign in to comment.