Skip to content

Commit 26c72b3

Browse files
authored
fix: support logptest wrapcore option (#312)
any logoption involving wrapcore is being overwritten by the zaptest wrapcore move it to the beginning so the provided LogOptions always get appllied
1 parent 020f7eb commit 26c72b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

logp/logptest/logptest.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ import (
3030
func NewTestingLogger(t testing.TB, selector string, options ...logp.LogOption) *logp.Logger {
3131
log := zaptest.NewLogger(t)
3232
log = log.Named(selector)
33-
options = append(options, zap.WrapCore(func(zapcore.Core) zapcore.Core {
33+
wrapCore := zap.WrapCore(func(zapcore.Core) zapcore.Core {
3434
return log.Core()
35-
}))
35+
})
36+
options = append([]logp.LogOption{wrapCore}, options...)
3637
logger, err := logp.NewDevelopmentLogger(selector, options...)
3738
if err != nil {
3839
t.Fatal(err)

0 commit comments

Comments
 (0)