From 7e4c916f0e98a149e80a4c2a4b5123a204d72ca8 Mon Sep 17 00:00:00 2001 From: Hunman Date: Mon, 2 Jan 2023 10:00:23 +0100 Subject: [PATCH] Replacing format strings with magic --- config.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index c069349..8956d4d 100644 --- a/config.go +++ b/config.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "os" "path/filepath" "strings" @@ -68,7 +67,7 @@ func loadAndwatchCfgFile(filename string) { provider := file.Provider(filename) if cfgError := k.Load(provider, toml.Parser()); cfgError != nil { - log.Warn().Msg(fmt.Sprintf("Error while trying to read %s: %s\n", filename, cfgError.Error())) + log.Warn().Str("filename", filename).Err(cfgError).Msg("Error while trying to read config file") } // Watch for changes and reload when detected @@ -78,7 +77,7 @@ func loadAndwatchCfgFile(filename string) { } if cfgError := k.Load(provider, toml.Parser()); cfgError != nil { - log.Warn().Msg(fmt.Sprintf("Error while trying to read %s: %s\n", filename, cfgError.Error())) + log.Warn().Str("filename", filename).Err(cfgError).Msg("Error while trying to read config file") } }) }