NewDevelopmentEncoderConfig returns an opinionated EncoderConfig for development environments. Messages encoded with this configuration will use Zap's console encoder intended to print human-readable output. It will print log messages with the following information: - The log level (e.g. "INFO", "
()
| 198 | // cfg := zap.NewDevelopmentEncoderConfig() |
| 199 | // cfg.EncodeTime = zapcore.ISO8601TimeEncoder |
| 200 | func NewDevelopmentEncoderConfig() zapcore.EncoderConfig { |
| 201 | return zapcore.EncoderConfig{ |
| 202 | // Keys can be anything except the empty string. |
| 203 | TimeKey: "T", |
| 204 | LevelKey: "L", |
| 205 | NameKey: "N", |
| 206 | CallerKey: "C", |
| 207 | FunctionKey: zapcore.OmitKey, |
| 208 | MessageKey: "M", |
| 209 | StacktraceKey: "S", |
| 210 | LineEnding: zapcore.DefaultLineEnding, |
| 211 | EncodeLevel: zapcore.CapitalLevelEncoder, |
| 212 | EncodeTime: zapcore.ISO8601TimeEncoder, |
| 213 | EncodeDuration: zapcore.StringDurationEncoder, |
| 214 | EncodeCaller: zapcore.ShortCallerEncoder, |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | // NewDevelopmentConfig builds a reasonable default development logging |
| 219 | // configuration. |
no outgoing calls