Manager: reduce logging of configuration service

This commit is contained in:
Sybren A. Stüvel 2022-03-17 11:08:50 +01:00
parent 22ea599554
commit dbc5109058

View File

@ -183,7 +183,7 @@ func getConf() (Conf, error) {
func DefaultConfig() Conf { func DefaultConfig() Conf {
c := defaultConfig c := defaultConfig
c.Meta.Version = latestConfigVersion c.Meta.Version = latestConfigVersion
c.constructVariableLookupTable() c.constructVariableLookupTable(zerolog.TraceLevel)
return c return c
} }
@ -221,7 +221,7 @@ func loadConf(filename string) (Conf, error) {
return c, fmt.Errorf("unable to parse %s: %w", filename, err) return c, fmt.Errorf("unable to parse %s: %w", filename, err)
} }
c.constructVariableLookupTable() c.constructVariableLookupTable(zerolog.DebugLevel)
c.parseURLs() c.parseURLs()
c.checkDatabase() c.checkDatabase()
c.checkVariables() c.checkVariables()
@ -230,7 +230,7 @@ func loadConf(filename string) (Conf, error) {
return c, nil return c, nil
} }
func (c *Conf) constructVariableLookupTable() { func (c *Conf) constructVariableLookupTable(logLevel zerolog.Level) {
lookup := map[VariableAudience]map[string]map[string]string{} lookup := map[VariableAudience]map[string]map[string]string{}
// Construct a list of all audiences except "" and "all" // Construct a list of all audiences except "" and "all"
@ -242,7 +242,7 @@ func (c *Conf) constructVariableLookupTable() {
} }
concreteAudiences = append(concreteAudiences, audience) concreteAudiences = append(concreteAudiences, audience)
} }
log.Debug(). log.Trace().
Interface("concreteAudiences", concreteAudiences). Interface("concreteAudiences", concreteAudiences).
Interface("isWildcard", isWildcard). Interface("isWildcard", isWildcard).
Msg("constructing variable lookup table") Msg("constructing variable lookup table")
@ -263,7 +263,7 @@ func (c *Conf) constructVariableLookupTable() {
if lookup[audience][platform] == nil { if lookup[audience][platform] == nil {
lookup[audience][platform] = map[string]string{} lookup[audience][platform] = map[string]string{}
} }
log.Debug(). log.Trace().
Str("audience", string(audience)). Str("audience", string(audience)).
Str("platform", platform). Str("platform", platform).
Str("name", name). Str("name", name).
@ -274,7 +274,7 @@ func (c *Conf) constructVariableLookupTable() {
// Construct the lookup table for each audience+platform+name // Construct the lookup table for each audience+platform+name
for name, variable := range c.Variables { for name, variable := range c.Variables {
log.Debug(). log.WithLevel(logLevel).
Str("name", name). Str("name", name).
Interface("variable", variable). Interface("variable", variable).
Msg("handling variable") Msg("handling variable")
@ -303,7 +303,7 @@ func (c *Conf) constructVariableLookupTable() {
} }
} }
} }
log.Debug(). log.Trace().
Interface("variables", c.Variables). Interface("variables", c.Variables).
Interface("lookup", lookup). Interface("lookup", lookup).
Msg("constructed lookup table") Msg("constructed lookup table")