19 lines
425 B
Go
19 lines
425 B
Go
|
package main
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
func logger(input string) {
|
||
|
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())
|
||
|
panic("----------------ERROR----------------")
|
||
|
}
|
||
|
}
|