Documentation
¶
Overview ¶
File: pkg/observability/logger.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
func Initialize(cfg LoggerConfig, consoleWriter zapcore.WriteSyncer)
Initialize sets up the global Zap logger based on configuration and a specified output writer.
func InitializeLogger ¶
func InitializeLogger(cfg LoggerConfig)
InitializeLogger is a convenience wrapper around Initialize for production use.
func ResetForTest ¶
func ResetForTest()
ResetForTest resets the sync.Once and clears the global logger.
Types ¶
type ColorConfig ¶ added in v0.1.7
type ColorConfig struct {
Debug string `mapstructure:"debug" yaml:"debug"`
Info string `mapstructure:"info" yaml:"info"`
Warn string `mapstructure:"warn" yaml:"warn"`
Error string `mapstructure:"error" yaml:"error"`
DPanic string `mapstructure:"dpanic" yaml:"dpanic"`
Panic string `mapstructure:"panic" yaml:"panic"`
Fatal string `mapstructure:"fatal" yaml:"fatal"`
}
ColorConfig specifies the terminal color codes for different log levels.
type LoggerConfig ¶ added in v0.1.7
type LoggerConfig struct {
Level string `mapstructure:"level" yaml:"level"`
Format string `mapstructure:"format" yaml:"format"`
AddSource bool `mapstructure:"add_source" yaml:"add_source"`
ServiceName string `mapstructure:"service_name" yaml:"service_name"`
LogFile string `mapstructure:"log_file" yaml:"log_file"`
MaxSize int `mapstructure:"max_size" yaml:"max_size"`
MaxBackups int `mapstructure:"max_backups" yaml:"max_backups"`
MaxAge int `mapstructure:"max_age" yaml:"max_age"`
Compress bool `mapstructure:"compress" yaml:"compress"`
Colors ColorConfig `mapstructure:"colors" yaml:"colors"`
}
LoggerConfig defines all settings related to logging.
Click to show internal directories.
Click to hide internal directories.