实现gorm.io/gorm/logger下的函数⬇️// gorm 源码
type Interface interface {
LogMode(LogLevel) Interface
Info(context.Context, string, ...interface{})
Warn(context.Context, string, ...interface{})
Error(context.Context, string, ...interface{})
Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)
}以下为自定义的重写实现,主要函数是Tracepackage log
import (
"context"
"time"
"github.com/go-kratos/kratos/v2/log"
"gorm.io/gorm/logger"
)
type GormLogger struct {
SlowThreshold time.Duration
}
func
...
继续阅读
(11)