2023-01-29 12:55:32 +00:00
|
|
|
package main
|
|
|
|
|
2023-01-29 15:18:52 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
2023-01-29 12:55:32 +00:00
|
|
|
|
|
|
|
func logger(input string) {
|
2023-01-29 15:23:03 +00:00
|
|
|
fileMkDir("./log")
|
2023-01-29 12:55:32 +00:00
|
|
|
println("[" + time.Now().Format("15:04:05") + "] " + input)
|
|
|
|
fileAddLine("["+time.Now().Format("15:04:05")+"] "+input, "./log/"+time.Now().Format("2006-02-01")+".log")
|
|
|
|
}
|
|
|
|
|
|
|
|
func errorPanic(err error, logBefore ...string) {
|
|
|
|
if err != nil {
|
|
|
|
for _, log := range logBefore {
|
|
|
|
logger(log)
|
|
|
|
}
|
|
|
|
logger(err.Error())
|
2023-01-29 15:09:39 +00:00
|
|
|
panic("\n----------------ERROR----------------\n")
|
2023-01-29 12:55:32 +00:00
|
|
|
}
|
|
|
|
}
|