feat: 升级日志
This commit is contained in:
@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
// NewGormV2 获取日志实例
|
||||
func NewGormV2(loggerLevel consts.LogLevel, consoleOutput bool, encoder zapcore.Encoder, splitConfig *loggerPkg.RotateLogConfig, traceIDField string, skip int) (logger.Interface, error) {
|
||||
func NewGormV2(loggerLevel loggerPkg.LogLevel, consoleOutput bool, encoder zapcore.Encoder, splitConfig *loggerPkg.RotateLogConfig, traceIDField string, skip int) (logger.Interface, error) {
|
||||
logConfList := []loggerPkg.SetLoggerOptionFunc{loggerPkg.WithEncoder(encoder), loggerPkg.WithCallerSkip(skip), loggerPkg.WithCaller()}
|
||||
if consoleOutput {
|
||||
logConfList = append(logConfList, loggerPkg.WithConsoleOutput())
|
||||
@ -151,7 +151,7 @@ func (g *Gorm) write(ctx context.Context, message string, level consts.LogLevel,
|
||||
g.outCtx = context.Background()
|
||||
}
|
||||
|
||||
dataList := loggerPkg.ZapLogDataList(loggerPkg.NewLogData(g.outCtx, consts.LogTypeDatabase, "", data))
|
||||
dataList := loggerPkg.NewLogData(g.outCtx, consts.LogTypeDatabase, "", data).ToFieldList()
|
||||
switch level {
|
||||
case consts.LogLevelDebug:
|
||||
g.instance.Debug(message, dataList...)
|
||||
|
||||
Reference in New Issue
Block a user