Skip to content

Commit

Permalink
fix logging when flag is passed on command line
Browse files Browse the repository at this point in the history
  • Loading branch information
themighty1 committed Feb 16, 2021
1 parent 2d57c00 commit c9ae47f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ func setupLogging() {
log.SetLogLevel(log.INFO)
}

if logFile != "" {
log.Close()
if err := log.OpenFile(logFile); err != nil {
log.Error("Error opening user defined log: %s %s", logFile, err)
}
var logFileToUse string
if logFile == "" {
logFileToUse = log.StdoutFile
} else {
logFileToUse = logFile
}
log.Close()
if err := log.OpenFile(logFileToUse); err != nil {
log.Error("Error opening user defined log: %s %s", logFileToUse, err)
}
}

Expand Down

0 comments on commit c9ae47f

Please sign in to comment.