(wo WriterOpener)
| 733 | } |
| 734 | |
| 735 | func newDefaultProductionLogEncoder(wo WriterOpener) zapcore.Encoder { |
| 736 | encCfg := zap.NewProductionEncoderConfig() |
| 737 | if IsWriterStandardStream(wo) && term.IsTerminal(int(os.Stderr.Fd())) { |
| 738 | // if interactive terminal, make output more human-readable by default |
| 739 | encCfg.EncodeTime = func(ts time.Time, encoder zapcore.PrimitiveArrayEncoder) { |
| 740 | encoder.AppendString(ts.UTC().Format("2006/01/02 15:04:05.000")) |
| 741 | } |
| 742 | if coloringEnabled { |
| 743 | encCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder |
| 744 | } |
| 745 | |
| 746 | return zapcore.NewConsoleEncoder(encCfg) |
| 747 | } |
| 748 | return zapcore.NewJSONEncoder(encCfg) |
| 749 | } |
| 750 | |
| 751 | func parseLevel(levelInput string) (zapcore.LevelEnabler, error) { |
| 752 | repl := NewReplacer() |
no test coverage detected