Replaced Beego logging
This commit is contained in:
+3
-9
@@ -4,15 +4,12 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
)
|
||||
|
||||
var initSync sync.Once
|
||||
|
||||
func Init(t *testing.T, skipOnShort bool) {
|
||||
if skipOnShort && testing.Short() {
|
||||
t.Skip("skipping test in short mode.")
|
||||
@@ -21,14 +18,11 @@ func Init(t *testing.T, skipOnShort bool) {
|
||||
appPath, _ := filepath.Abs(filepath.Join(filepath.Dir(file), ".."))
|
||||
confPath, _ := filepath.Abs(filepath.Join(appPath, "tests", "sonic-test.toml"))
|
||||
|
||||
os.Chdir(appPath)
|
||||
conf.LoadFromFile(confPath)
|
||||
|
||||
initSync.Do(func() {
|
||||
beego.TestBeegoInit(appPath)
|
||||
})
|
||||
|
||||
noLog := os.Getenv("NOLOG")
|
||||
if noLog != "" {
|
||||
beego.SetLevel(beego.LevelError)
|
||||
log.SetLevel(log.LevelError)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user