gorm日志增加默认的trace_id field

This commit is contained in:
白茶清欢 2021-03-05 00:02:58 +08:00
parent e655c031b2
commit 9b861374e3

View File

@ -32,6 +32,9 @@ func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.En
if nil != err { if nil != err {
return nil, err return nil, err
} }
if len(traceIDField) == 0 {
traceIDField = "trace_id"
}
return &Gorm{ return &Gorm{
instance: logInstance, instance: logInstance,
}, nil }, nil