feat:简化main函数
This commit is contained in:
11
util/log.go
11
util/log.go
@@ -4,7 +4,9 @@ import (
|
||||
"Mmx/Global"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -57,3 +59,12 @@ func (c *loG) Fatalln(a ...interface{}) {
|
||||
c.WriteLog("LoginError-"+c.timeStamp+".log", a...)
|
||||
log.Fatalln(a...)
|
||||
}
|
||||
|
||||
func (c *loG) CatchRecover() {
|
||||
if e := recover(); e != nil {
|
||||
c.Println(e)
|
||||
var buf [4096]byte
|
||||
c.Println(string(buf[:runtime.Stack(buf[:], false)]))
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user