Skip to content

Commit

Permalink
reduced verbosity when caching degree codes and descriptions via logg…
Browse files Browse the repository at this point in the history
…er configuraiton wtf!
  • Loading branch information
nad2000 committed Nov 27, 2019
1 parent f4f38fb commit e4d2c84
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions handler/common.go
Expand Up @@ -28,6 +28,7 @@ var (
counter int
log *zap.SugaredLogger
logger *zap.Logger
loggerCfg zap.Config
loggingLevel zap.AtomicLevel
oh Client
taskCreatedAt time.Time
Expand Down Expand Up @@ -71,7 +72,7 @@ func init() {
} else {
loggingLevel.Enabled(zap.InfoLevel)
}
logger, _ = zap.Config{
loggerCfg = zap.Config{
Level: loggingLevel,
Development: isDevelopment,
Encoding: "console",
Expand All @@ -90,7 +91,8 @@ func init() {
},
OutputPaths: []string{"stderr"},
ErrorOutputPaths: []string{"stderr"},
}.Build()
}
logger, _ = loggerCfg.Build()
log = logger.Sugar()
logFatal = log.Fatal
}
Expand All @@ -104,7 +106,7 @@ func setup() (err error) {
if qualifications == nil {
// Reduce verbosity
ll := loggingLevel.Level()
loggingLevel.Enabled(zap.ErrorLevel)
loggerCfg.Level.SetLevel(zap.ErrorLevel)
var list Qualifications
api.get("external-organisations/v1/qualifications", &list)
qualifications = make(map[string]string, len(list))
Expand All @@ -113,7 +115,7 @@ func setup() (err error) {
qualifications[q.Code] = q.Description
}
}
loggingLevel.Enabled(ll)
loggerCfg.Level.SetLevel(ll)
}
lock.Unlock()
return setupTask()
Expand Down

0 comments on commit e4d2c84

Please sign in to comment.