Create logs folder if it doesn't already exist

This commit is contained in:
Maximilian 2022-11-01 16:30:54 -05:00
parent 601b3d2cb0
commit 619469059c

View File

@ -18,7 +18,12 @@ func main() {
// Load config file to application // Load config file to application
app.Config = config.LoadConfig() app.Config = config.LoadConfig()
// Set log file // Create logs directory if it doesn't exist
if _, err := os.Stat("logs"); os.IsNotExist(err) {
os.Mkdir("logs", 0755)
}
// Create log file and set output
file, _ := os.Create("logs/log-" + time.Now().String() + ".log") file, _ := os.Create("logs/log-" + time.Now().String() + ".log")
log.SetOutput(file) log.SetOutput(file)