升级 gorm日志实现
This commit is contained in:
parent
013e3feb3c
commit
18dcfd6a90
@ -56,7 +56,8 @@ func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.En
|
||||
//
|
||||
// Date : 3:36 PM 2021/12/24
|
||||
func NewGormLoggerWithInstance(ctx *gin.Context, dbClient *gorm.DB, instance *zap.Logger, node string, extraCtxFieldList []string) logger.Interface {
|
||||
return &Gorm{
|
||||
nodeArr := strings.Split(node, "|")
|
||||
i := &Gorm{
|
||||
dbClient: dbClient,
|
||||
instance: instance,
|
||||
traceIDField: "",
|
||||
@ -65,6 +66,10 @@ func NewGormLoggerWithInstance(ctx *gin.Context, dbClient *gorm.DB, instance *za
|
||||
node: node,
|
||||
ctx: ctx,
|
||||
}
|
||||
if len(nodeArr) >= 2 {
|
||||
i.node = nodeArr[1]
|
||||
i.flag = nodeArr[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Gorm v2 版本库日志实现
|
||||
|
Loading…
Reference in New Issue
Block a user