diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-04-05 15:41:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 08:41:22 +0100 |
commit | fe3dcedd023c0b2fc767e74f53b90d1beadeb8a8 (patch) | |
tree | a2c704086d7dfc09f62d6a1a1150ca58b8bc00e6 /models/log.go | |
parent | 48ef04ee56272da4c8c8fd96b8af13fe82cd8e37 (diff) | |
download | gitea-fe3dcedd023c0b2fc767e74f53b90d1beadeb8a8.tar.gz gitea-fe3dcedd023c0b2fc767e74f53b90d1beadeb8a8.zip |
Fix xorm log stack level (#15285)
Diffstat (limited to 'models/log.go')
-rw-r--r-- | models/log.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/models/log.go b/models/log.go index 942dbc744a..caeab094bd 100644 --- a/models/log.go +++ b/models/log.go @@ -26,6 +26,8 @@ func NewXORMLogger(showSQL bool) xormlog.Logger { } } +const stackLevel = 8 + // Log a message with defined skip and at logging level func (l *XORMLogBridge) Log(skip int, level log.Level, format string, v ...interface{}) error { return l.logger.Log(skip+1, level, format, v...) @@ -33,42 +35,42 @@ func (l *XORMLogBridge) Log(skip int, level log.Level, format string, v ...inter // Debug show debug log func (l *XORMLogBridge) Debug(v ...interface{}) { - _ = l.Log(2, log.DEBUG, fmt.Sprint(v...)) + _ = l.Log(stackLevel, log.DEBUG, fmt.Sprint(v...)) } // Debugf show debug log func (l *XORMLogBridge) Debugf(format string, v ...interface{}) { - _ = l.Log(2, log.DEBUG, format, v...) + _ = l.Log(stackLevel, log.DEBUG, format, v...) } // Error show error log func (l *XORMLogBridge) Error(v ...interface{}) { - _ = l.Log(2, log.ERROR, fmt.Sprint(v...)) + _ = l.Log(stackLevel, log.ERROR, fmt.Sprint(v...)) } // Errorf show error log func (l *XORMLogBridge) Errorf(format string, v ...interface{}) { - _ = l.Log(2, log.ERROR, format, v...) + _ = l.Log(stackLevel, log.ERROR, format, v...) } // Info show information level log func (l *XORMLogBridge) Info(v ...interface{}) { - _ = l.Log(2, log.INFO, fmt.Sprint(v...)) + _ = l.Log(stackLevel, log.INFO, fmt.Sprint(v...)) } // Infof show information level log func (l *XORMLogBridge) Infof(format string, v ...interface{}) { - _ = l.Log(2, log.INFO, format, v...) + _ = l.Log(stackLevel, log.INFO, format, v...) } // Warn show warning log func (l *XORMLogBridge) Warn(v ...interface{}) { - _ = l.Log(2, log.WARN, fmt.Sprint(v...)) + _ = l.Log(stackLevel, log.WARN, fmt.Sprint(v...)) } // Warnf show warnning log func (l *XORMLogBridge) Warnf(format string, v ...interface{}) { - _ = l.Log(2, log.WARN, format, v...) + _ = l.Log(stackLevel, log.WARN, format, v...) } // Level get logger level |