Create logs folder if it doesn't already exist
This commit is contained in:
parent
601b3d2cb0
commit
619469059c
7
main.go
7
main.go
@ -18,7 +18,12 @@ func main() {
|
||||
// Load config file to application
|
||||
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")
|
||||
log.SetOutput(file)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user