修复sql日志无trace_id问题

This commit is contained in:
zhangdeman committed 2023-08-26 13:21:19 +08:00
1 parent 4566a456d9
commit 4c5a5ad0f1
1 file changed
+4 -1
+4 -1
View File
@@ -199,7 +199,10 @@ func (g *Gorm) write(dataList []zap.Field, level string) {
//
// Date : 10:11 下午 2021/3/1
func (g *Gorm) getTraceID(ctx context.Context) string {
return fmt.Sprintf("%v", ctx.Value(g.traceIDField))
if nil == g.ctx {
return ""
}
return g.ctx.GetString(g.traceIDField)
}
// GetGormSQL 获取trace fn
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.