Open dxvgef opened 6 years ago
zapcore.EncoderConfig
requires an encoder for the keys you've specified.
encodeConfig.LevelKey
is set but encodeConfig.EncodeLevel
is not.
https://godoc.org/go.uber.org/zap/zapcore#EncoderConfig
You can use the system defaults for the rest of the encoders:
EncodeLevel: zapcore.LowercaseLevelEncoder,
EncodeDuration: zapcore.SecondsDurationEncoder,
EncodeCaller: zapcore.ShortCallerEncoder,
It's possibly a bug that Config.Build does not error here.
I went back and forth on this, and at the time settled on forcing users of this API to be explicit about the behavior they'd prefer.
We could make config.Build
error here, or we could make zapcore.NewJSONEncoder
and zapcore.NewConsoleEncoder
automatically fall back to the default encoders.
It's normal to change "Encoding" to "console"