fehlerbehebung

This commit is contained in:
xoy 2023-01-29 16:23:03 +01:00
parent 5af7c13eed
commit 989d15a4c2
2 changed files with 9 additions and 3 deletions

View File

@ -40,3 +40,11 @@ func fileCreate(filepath string) {
logger("fileCreate : unknown -> " + filepath) logger("fileCreate : unknown -> " + filepath)
} }
} }
func fileMkDir(folderpath string) {
_, err := os.Stat(folderpath)
if errors.Is(err, os.ErrNotExist) {
err = os.Mkdir(folderpath, 0755)
errorPanic(err)
}
}

View File

@ -1,13 +1,11 @@
package main package main
import ( import (
"os"
"time" "time"
) )
func logger(input string) { func logger(input string) {
err := os.Mkdir("./log", 0755) fileMkDir("./log")
errorPanic(err)
println("[" + time.Now().Format("15:04:05") + "] " + input) println("[" + time.Now().Format("15:04:05") + "] " + input)
fileAddLine("["+time.Now().Format("15:04:05")+"] "+input, "./log/"+time.Now().Format("2006-02-01")+".log") fileAddLine("["+time.Now().Format("15:04:05")+"] "+input, "./log/"+time.Now().Format("2006-02-01")+".log")
} }