123456789101112131415161718 |
- package utils
- import (
- "git.haoqitour.com/haoqi/go-common/utils/logger"
- "github.com/prometheus/common/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.Warn(action, " goroutine 异常 ", e.Error())
- }
- }
- }
- }
|