Compare commits

...

2 Commits

Author SHA1 Message Date
Berengar W. Lehr
61f0f65bf1 Better comment for logPath default value 2023-09-28 11:01:54 +02:00
Berengar W. Lehr
fcc502edcf Only update config if config file is actually used 2023-09-28 11:01:37 +02:00
2 changed files with 4 additions and 2 deletions

View File

@ -419,7 +419,6 @@ func InitConfig() {
viper.SetConfigName("config")
err = viper.ReadInConfig()
log.ConfigLogger(LogEnabled.GetBool(), LogStandard.GetString(), LogPath.GetString(), LogLevel.GetString())
if viper.ConfigFileUsed() != "" {
log.Infof("Using config file: %s", viper.ConfigFileUsed())
@ -427,6 +426,8 @@ func InitConfig() {
if err != nil {
log.Warning(err.Error())
log.Warning("Using default config.")
} else {
log.ConfigLogger(LogEnabled.GetBool(), LogStandard.GetString(), LogPath.GetString(), LogLevel.GetString())
}
} else {
log.Info("No config file found, using default or config from environment variables.")

View File

@ -39,7 +39,8 @@ const logModule = `vikunja`
// loginstance is the instance of the logger which is used under the hood to log
var logInstance = logging.MustGetLogger(logModule)
// logpath is the path in which log files will be written. This value should actually never be used
// logpath is the path in which log files will be written.
// This value is a mere fallback for other modules that could but shouldn't be used before calling ConfigLogger
var logPath = "."
// InitLogger initializes the global log handler