Add JSON structured logging

This commit is contained in:
Piper Pentagram 2024-11-06 14:19:45 -08:00
parent 60b9d77873
commit c06d77485c
6 changed files with 51 additions and 6 deletions

View file

@ -15,6 +15,7 @@ type AppConfig struct {
LogMaxBackups int `yaml:"log_max_backups"`
LogMaxAgeDays int `yaml:"log_max_age_days"`
LogCompression bool `yaml:"log_compression"`
LogAddSource bool `yaml:"log_add_source"`
}
func parseConfigs() error {
@ -43,9 +44,10 @@ func parseConfigs() error {
func setDefaults() {
viper.SetDefault("LogFile", "bingobot.log")
viper.SetDefault("LogDir", "bingobot.log")
viper.SetDefault("LogDir", "log")
viper.SetDefault("LogMaxSizeMB", 500)
viper.SetDefault("LogMaxBackups", 3)
viper.SetDefault("LogMaxAgeDays", 365)
viper.SetDefault("LogCompression", false)
viper.SetDefault("LogAddSource", true)
}