[#230] Refactor logger tag configuration

Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
Pavel Pogodaev 2025-04-16 17:53:49 +03:00 committed by Alexey Vanin
parent b9f1f455f8
commit b7b08d9d82
3 changed files with 5 additions and 14 deletions

View file

@ -198,17 +198,11 @@ func (t *tagsConfig) update(cfg *viper.Viper, ll zapcore.Level) error {
return err
}
t.tagLogs.Range(func(key, value any) bool {
t.tagLogs.Range(func(key, _ any) bool {
k := key.(string)
v := value.(zapcore.Level)
if lvl, ok := tags[k]; ok {
if lvl != v {
t.tagLogs.Store(key, lvl)
}
} else {
if _, ok := tags[k]; !ok {
t.tagLogs.Delete(key)
delete(tags, k)
}
return true
})
@ -695,7 +689,7 @@ func (a *app) configReload(ctx context.Context) {
return
}
a.settings.logLevelConfig.update(a.cfg.settings, a.log)
a.settings.logLevelConfig.update(a.cfg.config(), a.log)
if err := a.settings.dialerSource.Update(fetchMultinetConfig(a.config(), a.log)); err != nil {
a.log.Warn(logs.MultinetConfigWontBeUpdated, zap.Error(err), logs.TagField(logs.TagApp))