github.com/ipni/storetheindex@v0.8.30/assigner/config/logging.go (about) 1 package config 2 3 // Logging configures overall and logger-specific log levels. Level values are 4 // case-insensitive and include the following in order of importance: "fatal", 5 // "panic", "dpanic", ""error", "warn", "info", "debug" 6 type Logging struct { 7 // Level sets the log level for all loggers that do not have a setting in 8 // Loggers. The default value is "info". 9 Level string 10 // Loggers sets log levels for individual loggers. 11 Loggers map[string]string 12 } 13 14 // NewLogging returns Logging with values set to their defaults. 15 func NewLogging() Logging { 16 return Logging{ 17 Level: "info", 18 Loggers: map[string]string{ 19 "basichost": "warn", 20 "bootstrap": "warn", 21 }, 22 } 23 } 24 25 // populateUnset replaces zero-values in the config with default values. 26 func (c *Logging) populateUnset() { 27 def := NewLogging() 28 29 if c.Level == "" { 30 c.Level = def.Level 31 32 // If no overall logging level was set, and no level set for loggers, 33 // then set levels for certain loggers. 34 if len(c.Loggers) == 0 { 35 c.Loggers = def.Loggers 36 } 37 } 38 }