NewConsoleEncoder creates an encoder whose output is designed for human - rather than machine - consumption. It serializes the core log entry data (message, level, timestamp, etc.) in a plain-text format and leaves the structured context as JSON. Note that although the console encoder doesn't use t
(cfg EncoderConfig)
| 56 | // encoder configuration, it will omit any element whose key is set to the empty |
| 57 | // string. |
| 58 | func NewConsoleEncoder(cfg EncoderConfig) Encoder { |
| 59 | if cfg.ConsoleSeparator == "" { |
| 60 | // Use a default delimiter of '\t' for backwards compatibility |
| 61 | cfg.ConsoleSeparator = "\t" |
| 62 | } |
| 63 | return consoleEncoder{newJSONEncoder(cfg, true)} |
| 64 | } |
| 65 | |
| 66 | func (c consoleEncoder) Clone() Encoder { |
| 67 | return consoleEncoder{c.jsonEncoder.Clone().(*jsonEncoder)} |