Explicitly configure default logfile for stderr

This commit is contained in:
Jonathon Reinhart
2021-03-13 03:21:53 -05:00
parent 095fba119a
commit 9921b38046
2 changed files with 4 additions and 2 deletions

View File

@@ -16,7 +16,9 @@ func setupLogger() {
log = logrus.New()
// Handle logfile
if (*logFile != "") {
if (*logFile == "") {
log.SetOutput(os.Stderr)
} else {
writer, err := os.OpenFile(*logFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0600)
if err != nil {
fmt.Printf("cannot open log file: %s\n", err)