[WIP] Fix logger starting bug

This commit is contained in:
Vladimir Stoilov
2024-11-28 13:27:10 +02:00
parent 374c1c2748
commit de3f5a8692

View File

@@ -191,7 +191,7 @@ func ParseLevel(level string) Severity {
} }
// Start starts the logging system. Must be called in order to see logs. // Start starts the logging system. Must be called in order to see logs.
func Start(level string, logToStdout bool, logDir string) (err error) { func Start(level string, logToStdout bool, logDir string) error {
if !initializing.SetToIf(false, true) { if !initializing.SetToIf(false, true) {
return nil return nil
} }
@@ -232,13 +232,13 @@ func Start(level string, logToStdout bool, logDir string) (err error) {
// Delete all logs older than one month. // Delete all logs older than one month.
if !logToStdout { if !logToStdout {
err = CleanOldLogs(logDir, 30*24*time.Hour) err := CleanOldLogs(logDir, 30*24*time.Hour)
if err != nil { if err != nil {
Errorf("log: failed to clean old log files: %s", err) Errorf("log: failed to clean old log files: %s", err)
} }
} }
return err return nil
} }
// Shutdown writes remaining log lines and then stops the log system. // Shutdown writes remaining log lines and then stops the log system.