logger: fix Clone #164
@ -49,7 +49,7 @@ func (l *defaultLogger) Clone(opts ...Option) Logger {
|
|||||||
|
|
||||||
oldopts.Wrappers = newopts.Wrappers
|
oldopts.Wrappers = newopts.Wrappers
|
||||||
l.Lock()
|
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()
|
l.Unlock()
|
||||||
|
|
||||||
// wrap the Log func
|
// wrap the Log func
|
||||||
|
@ -86,12 +86,12 @@ func TestTaggedNested(t *testing.T) {
|
|||||||
unk string
|
unk string
|
||||||
}
|
}
|
||||||
type str struct {
|
type str struct {
|
||||||
key string `logger:"omit"`
|
|
||||||
val *val `logger:"take"`
|
val *val `logger:"take"`
|
||||||
|
key string `logger:"omit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var iface interface{}
|
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
|
iface = v
|
||||||
buf := fmt.Sprintf("%#v", Unwrap(iface, Tagged(true)))
|
buf := fmt.Sprintf("%#v", Unwrap(iface, Tagged(true)))
|
||||||
if strings.Compare(buf, `&unwrap.str{val:(*unwrap.val){key:"test"}}`) != 0 {
|
if strings.Compare(buf, `&unwrap.str{val:(*unwrap.val){key:"test"}}`) != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user