таким:
"ts":1556619200.7463682
??
Там есть настройка
var zapLog *zap.Logger func main() { InitZapLogger() } func InitZapLogger() { w := zapcore.AddSync(&lumberjack.Logger{ Filename: "test.log", MaxSize: 100, // megabytes MaxBackups: 10, MaxAge: 28, // days }) core := zapcore.NewCore( zapcore.NewJSONEncoder(zapcore.EncoderConfig{ TimeKey: "ts", LevelKey: "level", NameKey: "logger", CallerKey: "caller", MessageKey: "msg", StacktraceKey: "stacktrace", LineEnding: zapcore.DefaultLineEnding, EncodeLevel: zapcore.LowercaseLevelEncoder, EncodeTime: zapcore.ISO8601TimeEncoder, EncodeDuration: zapcore.SecondsDurationEncoder, EncodeCaller: zapcore.ShortCallerEncoder, }), w, zap.InfoLevel, ) zapLog = zap.New(core) }
Обсуждают сегодня