slim trace if depth (#4346)

Co-authored-by: gogs <guzzsek@gmail.com>
This commit is contained in:
我的我的 2021-05-05 08:14:40 +08:00 committed by GitHub
parent 8f7f3ad315
commit 3f359eab9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,7 +139,11 @@ func (l logger) Error(ctx context.Context, msg string, data ...interface{}) {
// Trace print sql message
func (l logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
if l.LogLevel > Silent {
if l.LogLevel <= Silent {
return
}
elapsed := time.Since(begin)
switch {
case err != nil && l.LogLevel >= Error && (!errors.Is(err, ErrRecordNotFound) || !l.IgnoreRecordNotFoundError):
@ -166,7 +170,6 @@ func (l logger) Trace(ctx context.Context, begin time.Time, fc func() (string, i
}
}
}
}
type traceRecorder struct {
Interface