slim trace if depth
This commit is contained in:
parent
70e93e73d8
commit
5920c33a1c
@ -139,7 +139,11 @@ func (l logger) Error(ctx context.Context, msg string, data ...interface{}) {
|
|||||||
|
|
||||||
// Trace print sql message
|
// Trace print sql message
|
||||||
func (l logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
|
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)
|
elapsed := time.Since(begin)
|
||||||
switch {
|
switch {
|
||||||
case err != nil && l.LogLevel >= Error && (!errors.Is(err, ErrRecordNotFound) || !l.IgnoreRecordNotFoundError):
|
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 {
|
type traceRecorder struct {
|
||||||
Interface
|
Interface
|
||||||
|
Loading…
x
Reference in New Issue
Block a user