Skip to content

Commit

Permalink
Format error message, use log.Fatalf for panic message of Mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
MirageTurtle committed Aug 7, 2024
1 parent bc71a8f commit ff51f68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (r *RadiusCredentials) accountingCron(accessLogger, errorLogger *log.Logger
}
})
if err != nil {
log.Fatalf("[ERR] Add accounting cron job: %s", err)
log.Fatalf("[ERR] Failed to add accounting cron job: %s", err)
}
c.Start()
return c
Expand All @@ -157,7 +157,7 @@ func init() {
gantedLogDir := getEnv("GANTED_LOG_DIR", "/var/log/ganted")
if _, err := os.Stat(gantedLogDir); os.IsNotExist(err) {
if err := os.Mkdir(gantedLogDir, 0755); err != nil {
panic(err)
log.Fatalf("[ERR] Failed to create ganted log directory %s: %s", gantedLogDir, err)
}
}
}
Expand All @@ -168,7 +168,7 @@ func setFileLoggerOutput(logger *log.Logger, filePath string) error {
}
file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
if err != nil {
log.Fatalf("[ERR] Open log file: %s", err)
log.Fatalf("[ERR] Failed to open file %s: %s", filePath, err)
}
prevWriter := logger.Writer()
logger.SetOutput(file)
Expand Down

0 comments on commit ff51f68

Please sign in to comment.