[#493] logger: Do not set global fields in constructor
Remove setting of `app_name` and `app_version` fields in `NewLogger` constructor. Set these fields in Node and IR application in already constructed log and remove them from viper . Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
d17526f8ac
commit
2a970b0125
4 changed files with 11 additions and 17 deletions
|
@ -355,6 +355,11 @@ func initCfg(path string) *cfg {
|
|||
log, err := logger.NewLogger(viperCfg)
|
||||
fatalOnErr(err)
|
||||
|
||||
log = log.With(
|
||||
zap.String("app_name", misc.NodeName),
|
||||
zap.String("app_version", misc.Version),
|
||||
)
|
||||
|
||||
netAddr, err := network.AddressFromString(viperCfg.GetString(cfgBootstrapAddress))
|
||||
fatalOnErr(err)
|
||||
|
||||
|
@ -442,9 +447,6 @@ func initViper(path string) *viper.Viper {
|
|||
v.AutomaticEnv()
|
||||
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
|
||||
v.SetDefault("app.name", misc.NodeName)
|
||||
v.SetDefault("app.version", misc.Version)
|
||||
|
||||
defaultConfiguration(v)
|
||||
|
||||
if path != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue