From 4acde81cc47656f995b9e16e57947a2cd491a677 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 4 Jan 2023 11:26:35 +0800 Subject: [PATCH] Error code standardization --- pkg/common/trace_log/ctx.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/common/trace_log/ctx.go b/pkg/common/trace_log/ctx.go index 4b2e21f32..49857a9f5 100644 --- a/pkg/common/trace_log/ctx.go +++ b/pkg/common/trace_log/ctx.go @@ -30,7 +30,12 @@ func SetOperationID(ctx context.Context, operationID string) { func ShowLog(ctx context.Context) { t := ctx.Value(TraceLogKey).(*ApiInfo) - log.Info(t.OperationID, "api: ", t.ApiName) + if ctx.Value(TraceLogKey).(*ApiInfo).GinCtx != nil { + log.Info(t.OperationID, "api: ", t.ApiName) + } else { + log.Info(t.OperationID, "rpc: ", t.ApiName) + } + for _, v := range *t.Funcs { if v.Err != nil { log.Error(t.OperationID, "func: ", v.FuncName, " args: ", v.Args, v.Err.Error())