summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-22 19:44:51 +0800
committerGitHub <noreply@github.com>2017-02-22 19:44:51 +0800
commitd6748284bd6b4424d0e50cb4b952d12c74203960 (patch)
tree4adc337cdafd4a55a1eb7f0de7271a226d854407 /modules
parent01d957677f160e4b5e43ce043b05e246493b34ea (diff)
downloadgitea-d6748284bd6b4424d0e50cb4b952d12c74203960.tar.gz
gitea-d6748284bd6b4424d0e50cb4b952d12c74203960.zip
fix panic when push but the only log mode console is disabled by serv and update commands (#1007)
Diffstat (limited to 'modules')
-rw-r--r--modules/log/xorm.go7
-rw-r--r--modules/setting/setting.go4
2 files changed, 11 insertions, 0 deletions
diff --git a/modules/log/xorm.go b/modules/log/xorm.go
index 9b23d9f370..113cfdad53 100644
--- a/modules/log/xorm.go
+++ b/modules/log/xorm.go
@@ -22,6 +22,13 @@ var (
XORMLogger *XORMLogBridge
)
+// DiscardXORMLogger inits a blank logger for xorm
+func DiscardXORMLogger() {
+ XORMLogger = &XORMLogBridge{
+ showSQL: false,
+ }
+}
+
// NewXORMLogger generate logger for xorm FIXME: configable
func NewXORMLogger(bufferlen int64, mode, config string) {
logger := newLogger(bufferlen)
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index fbb283a9da..dd06691dc3 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1096,6 +1096,10 @@ func NewXORMLogService(disableConsole bool) {
}
log.XORMLogger.SetLevel(lvl)
}
+
+ if len(logConfigs) == 0 {
+ log.DiscardXORMLogger()
+ }
}
func newCacheService() {