mirror of https://github.com/go-gorm/gorm.git
Recorder追踪函数trace在finish_api文件358行scan函数所在的371行被调用时,BeginAt 没有赋值,默认值0001-0:0:0导致追踪日志显示的sql耗时无限大. (#3657)
Co-authored-by: 张奇峰 <10515935zwj>
This commit is contained in:
parent
231aba53c5
commit
6d90d09cb8
|
@ -64,7 +64,7 @@ var (
|
||||||
LogLevel: Warn,
|
LogLevel: Warn,
|
||||||
Colorful: true,
|
Colorful: true,
|
||||||
})
|
})
|
||||||
Recorder = traceRecorder{Interface: Default}
|
Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()}
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(writer Writer, config Config) Interface {
|
func New(writer Writer, config Config) Interface {
|
||||||
|
@ -173,7 +173,7 @@ type traceRecorder struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l traceRecorder) New() *traceRecorder {
|
func (l traceRecorder) New() *traceRecorder {
|
||||||
return &traceRecorder{Interface: l.Interface}
|
return &traceRecorder{Interface: l.Interface, BeginAt: time.Now()}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *traceRecorder) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
|
func (l *traceRecorder) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
|
||||||
|
|
Loading…
Reference in New Issue