NewProductionEncoderConfig returns an opinionated EncoderConfig for production environments. Messages encoded with this configuration will be JSON-formatted and will have the following keys by default: - "level": The logging level (e.g. "info", "error"). - "ts": The current time in number of secon
()
| 122 | // cfg := zap.NewProductionEncoderConfig() |
| 123 | // cfg.EncodeTime = zapcore.ISO8601TimeEncoder |
| 124 | func NewProductionEncoderConfig() zapcore.EncoderConfig { |
| 125 | return zapcore.EncoderConfig{ |
| 126 | TimeKey: "ts", |
| 127 | LevelKey: "level", |
| 128 | NameKey: "logger", |
| 129 | CallerKey: "caller", |
| 130 | FunctionKey: zapcore.OmitKey, |
| 131 | MessageKey: "msg", |
| 132 | StacktraceKey: "stacktrace", |
| 133 | LineEnding: zapcore.DefaultLineEnding, |
| 134 | EncodeLevel: zapcore.LowercaseLevelEncoder, |
| 135 | EncodeTime: zapcore.EpochTimeEncoder, |
| 136 | EncodeDuration: zapcore.SecondsDurationEncoder, |
| 137 | EncodeCaller: zapcore.ShortCallerEncoder, |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | // NewProductionConfig builds a reasonable default production logging |
| 142 | // configuration. |
no outgoing calls