mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
优化异常捕获日志
This commit is contained in:
@@ -180,16 +180,10 @@ func (slf *BaseMessageReciver) startReadMsg(pclient *WSClient) {
|
||||
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)
|
||||
service.GetLogger().Printf(service.LEVER_FATAL, coreInfo)
|
||||
slf.messageReciver.OnDisconnect(pclient.clientid, errors.New("core dump"))
|
||||
slf.messageReciver.OnDisconnect(pclient.clientid, errors.New("Core dump"))
|
||||
slf.WsServer.ReleaseClient(pclient)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user