Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Discard slog.Handler = discardHandler{}
Discard is a [Handler] which is always disabled and therefore logs nothing.
View Source
var LogLevels = map[zapcore.Level]slog.Level{ zapcore.DebugLevel: slog.LevelDebug, zapcore.InfoLevel: slog.LevelInfo, zapcore.WarnLevel: slog.LevelWarn, zapcore.ErrorLevel: slog.LevelError, zapcore.DPanicLevel: slog.LevelError, zapcore.PanicLevel: slog.LevelError, zapcore.FatalLevel: slog.LevelError, }
Functions ¶
func ColoredLevelEncoder ¶
func ColoredLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
ColoredLevelEncoder colorizes log levels.
func ColoredNameEncoder ¶
func ColoredNameEncoder(s string, enc zapcore.PrimitiveArrayEncoder)
ColoredNameEncoder colorizes service names.
Types ¶
type Config ¶
type Config struct { // Mode configures logger based on some default template (development, production, off). Mode Mode `json:"mode" yaml:"mode"` // Level is the minimum enabled logging level. Note that this is a dynamic // level, so calling ChannelConfig.Level.SetLevel will atomically change the log // level of all loggers descended from this config. Level string `json:"level" yaml:"level"` // LineEnding line ending. Default: "\n" for the all modes except production LineEnding string `json:"line_ending" yaml:"line_ending"` // Encoding sets the logger's encoding. InitDefault values are "json" and // "console", as well as any third-party encodings registered via // RegisterEncoder. Encoding string `json:"encoding" yaml:"encoding"` // Output is a list of URLs or file paths to write logging output to. // See Open for details. Output []string `json:"output" yaml:"output"` // ErrorOutput is a list of URLs to write internal logger errors to. // The default is standard error. // // Note that this setting only affects internal errors; for sample code that // sends error-level logs to a different location from info- and debug-level // logs, see the package-level AdvancedConfiguration example. ErrorOutput []string `json:"error_output" yaml:"error_output"` // File logger options FileLogger *lumberjack.Logger `json:"file_logger,omitempty" yaml:"file_logger,omitempty"` }
func (*Config) InitDefaults ¶
func (cfg *Config) InitDefaults()
Click to show internal directories.
Click to hide internal directories.