Skip to content

Commit 3d5fe4e

Browse files
authored
Merge pull request #14 from snabble/fix_gorm_trace
Only trace log in GormLogger if level is Debug
2 parents 2a95546 + ff21615 commit 3d5fe4e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gorm_logger.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func (l *gormLogger) Error(ctx context.Context, s string, args ...interface{}) {
4242
}
4343

4444
func (l *gormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
45+
if !Log.IsLevelEnabled(logrus.DebugLevel) {
46+
return
47+
}
4548
elapsed := time.Since(begin)
4649
sql, _ := fc()
4750
fields := logrus.Fields{}

0 commit comments

Comments
 (0)