Documentation ¶
Overview ¶
Package encoder implements log encoders used to output logs in varying ways.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { MessageKey *string `json:"message_key,omitempty"` LevelKey *string `json:"level_key,omitempty"` TimeKey *string `json:"time_key,omitempty"` NameKey *string `json:"name_key,omitempty"` CallerKey *string `json:"caller_key,omitempty"` StacktraceKey *string `json:"stacktrace_key,omitempty"` LineEnding *string `json:"line_ending,omitempty"` TimeFormat string `json:"time_format,omitempty"` DurationFormat string `json:"duration_format,omitempty"` LevelFormat string `json:"level_format,omitempty"` CallerFormat string `json:"caller_format,omitempty"` }
Config represents the configuration for a log encoder.
func (*Config) ZapcoreEncoderConfig ¶
func (c *Config) ZapcoreEncoderConfig() zapcore.EncoderConfig
ZapcoreEncoderConfig returns a zap encoder config, built from the Config values.
type Console ¶
Console is a log encoder for human-readable colored console output. This encoder is designed for development where only humans are reading the output.
type JSON ¶
JSON is a log encoder for machine-readable JSON objects. Each line is output as a separate JSON object, essentially making the entire log output JSON-ND. This encoder is designed for production where logs are read and ingested by log aggregation systems.
type Logfmt ¶
Logfmt is a log encoder for machine and human-readable logs, it follows the logfmt "standard" first documented by [Brandur Leach](https://brandur.org/logfmt). This encoder is designed for both development and production where logs may need to be read by both humans and log aggregation systems, it's a middle ground between the Console and JSON log encoders. This is the default log encoder.