修复sql日志无trace_id问题
This commit is contained in:
parent
4566a456d9
commit
4c5a5ad0f1
@ -199,7 +199,10 @@ func (g *Gorm) write(dataList []zap.Field, level string) {
|
|||||||
//
|
//
|
||||||
// Date : 10:11 下午 2021/3/1
|
// Date : 10:11 下午 2021/3/1
|
||||||
func (g *Gorm) getTraceID(ctx context.Context) string {
|
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
|
// GetGormSQL 获取trace fn
|
||||||
|
Loading…
Reference in New Issue
Block a user