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)
}
}
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
import (
"os"
"time"
)
func logger(input string) {
err := os.Mkdir("./log", 0755)
errorPanic(err)
fileMkDir("./log")
println("[" + time.Now().Format("15:04:05") + "] " + input)
fileAddLine("["+time.Now().Format("15:04:05")+"] "+input, "./log/"+time.Now().Format("2006-02-01")+".log")
}