mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
优化异常捕获日志
This commit is contained in:
@@ -130,6 +130,7 @@ import (
|
||||
"bufio"
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
@@ -396,14 +397,10 @@ func (s *service) call(server *Server, sending *sync.Mutex, wg *sync.WaitGroup,
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
var coreInfo string
|
||||
str, ok := r.(string)
|
||||
if ok {
|
||||
coreInfo += str + "\n" + string(runtimedebug.Stack())
|
||||
} else {
|
||||
coreInfo = "Panic!"
|
||||
}
|
||||
|
||||
coreInfo = string(runtimedebug.Stack())
|
||||
coreInfo += "\nCore Request RPC Name:" + req.ServiceMethod
|
||||
coreInfo += "\n" + fmt.Sprintf("Core information is %v\n", r)
|
||||
orginservice.GetLogger().Printf(orginservice.LEVER_FATAL, coreInfo)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user