log 增加记录当前调用者的调用信息
This commit is contained in:
parent
5c2253cf92
commit
3a32575bab
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
"voucher/internal/biz/bo"
|
"voucher/internal/biz/bo"
|
||||||
"voucher/internal/biz/vo"
|
"voucher/internal/biz/vo"
|
||||||
|
|
@ -161,16 +162,17 @@ func (v *VoucherBiz) ExecuteNotice(ctx context.Context, req *bo.FindInBatchesUse
|
||||||
func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo, notifyNum *int) (respErr error) {
|
func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo, notifyNum *int) (respErr error) {
|
||||||
// 批量通知不做数据存储,量会很大
|
// 批量通知不做数据存储,量会很大
|
||||||
|
|
||||||
defer func() {
|
|
||||||
if err := recover(); err != nil {
|
|
||||||
respErr = fmt.Errorf("panic:%v", err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if order == nil {
|
if order == nil {
|
||||||
return fmt.Errorf("order is nil")
|
return fmt.Errorf("order is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
_, file, line, _ := runtime.Caller(1) // 1 表示获取当前调用者的调用信息
|
||||||
|
respErr = fmt.Errorf("notice panic:%v, orderNo:%s, file:%s, line:%d", err, order.OrderNo, file, line)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
status, err := v.WechatCpnRepo.Query(ctx, order)
|
status, err := v.WechatCpnRepo.Query(ctx, order)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -210,7 +212,8 @@ func (v *VoucherBiz) request(ctx context.Context, order *bo.OrderBo, notify *bo.
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
respErr = fmt.Errorf("panic:%v,orderNo:%s", err, order.OrderNo)
|
_, file, line, _ := runtime.Caller(1) // 1 表示获取当前调用者的调用信息
|
||||||
|
respErr = fmt.Errorf("panic:%v, orderNo:%s, file:%s, line:%d", err, order.OrderNo, file, line)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue