优化异常捕获日志

This commit is contained in:
boyce
2019-03-25 18:12:29 +08:00
parent 738bf3d5b8
commit a74c45c248
6 changed files with 21 additions and 31 deletions

View File

@@ -10,14 +10,8 @@ func F(callback interface{}, args ...interface{}) {
defer func() {
if r := recover(); r != nil {
var coreInfo string
str, ok := r.(string)
if ok {
coreInfo = string(debug.Stack())
} else {
coreInfo = "Panic!"
}
coreInfo += "\n" + fmt.Sprintf("core information is %s\n", str)
coreInfo = string(debug.Stack())
coreInfo += "\n" + fmt.Sprintf("Core information is %v\n", r)
if Log != nil {
Log(5, coreInfo)
} else {