1
0
Fork 0
forked from forgejo/forgejo

Move xorm logger bridge from log to models so that log module could be a standalone package (#6944)

* move xorm logger bridge from log to models so that log module could be a standalone package

* fix tests

* save logger on xorm log bridge
This commit is contained in:
Lunny Xiao 2019-05-14 15:04:07 +08:00 committed by Lauris BH
parent 0e057eb033
commit 8b36f01f45
3 changed files with 25 additions and 35 deletions

View file

@ -15,7 +15,6 @@ import (
"path/filepath"
"strings"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
// Needed for the MySQL driver
@ -261,7 +260,7 @@ func NewTestEngine(x *xorm.Engine) (err error) {
}
x.SetMapper(core.GonicMapper{})
x.SetLogger(log.XORMLogger)
x.SetLogger(NewXORMLogger(!setting.ProdMode))
x.ShowSQL(!setting.ProdMode)
return x.StoreEngine("InnoDB").Sync2(tables...)
}
@ -276,7 +275,7 @@ func SetEngine() (err error) {
x.SetMapper(core.GonicMapper{})
// WARNING: for serv command, MUST remove the output to os.stdout,
// so use log file to instead print to stdout.
x.SetLogger(log.XORMLogger)
x.SetLogger(NewXORMLogger(setting.LogSQL))
x.ShowSQL(setting.LogSQL)
return nil
}