1234567891011121314151617181920 |
- package utils
- import (
- "git.aionnect.com/aionnect/go-common/utils/logger"
- "log"
- )
- func DefaultGoroutineRecover(l *logger.Logger, action string) {
- if err := recover(); err != nil {
- if e, ok := err.(error); ok {
- if nil != l {
- l.WithField("err", e.Error()).Error(action, " goroutine 异常")
- } else {
- log.Print(action, " goroutine 异常 ", e.Error())
- }
- stack := string(GetStack(3))
- println(stack)
- }
- }
- }
|