You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Add more flexibility in configuring zap logger for tests.**
The default `zapcore.Core`, which is created in `zaptest.NewLogger()`
may not be suitable for all use-cases.
```
func NewLogger(t TestingT, opts ...LoggerOption) *zap.Logger {
...
return zap.New(
zapcore.NewCore(
zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()),
writer,
cfg.Level,
),
zapOptions...,
)
```
E.g., we may need custom encoder or encoder config.
This PR allows us to do such customization:
```
writer := zaptest.NewTestingWriter(t)
core := zapcore.NewCore(encoder, writer, level)
logger := zap.New(core, zap.AddCaller())
```
0 commit comments