Fixing the console level debug statements (#4092)

Этот коммит содержится в:
Corey Hulen
2016-09-27 07:07:32 -07:00
коммит произвёл enahum
родитель 667db6e10c
Коммит bfca752940
6 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@@ -154,7 +154,6 @@ func TestEmailTest(t *testing.T) {
if _, err := th.SystemAdminClient.TestEmail(utils.Cfg); err == nil { if _, err := th.SystemAdminClient.TestEmail(utils.Cfg); err == nil {
t.Fatal("should have errored") t.Fatal("should have errored")
} else { } else {
println(err.Id)
if err.Id != "api.admin.test_email.missing_server" { if err.Id != "api.admin.test_email.missing_server" {
t.Fatal(err) t.Fatal(err)
} }

Просмотреть файл

@@ -564,7 +564,9 @@ func TestGetTeamMembers(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} else { } else {
members := result.Data.([]*model.TeamMember) members := result.Data.([]*model.TeamMember)
t.Log(members) if members == nil {
t.Fatal("should be valid")
}
} }
} }

Просмотреть файл

@@ -55,7 +55,7 @@
"AtRestEncryptKey": "" "AtRestEncryptKey": ""
}, },
"LogSettings": { "LogSettings": {
"EnableConsole": true, "EnableConsole": false,
"ConsoleLevel": "DEBUG", "ConsoleLevel": "DEBUG",
"EnableFile": true, "EnableFile": true,
"FileLevel": "INFO", "FileLevel": "INFO",

Просмотреть файл

@@ -766,8 +766,6 @@ func TestGetMemberCount(t *testing.T) {
} }
Must(store.Channel().Save(&c2)) Must(store.Channel().Save(&c2))
t.Logf("c1.Id = %v", c1.Id)
u1 := &model.User{ u1 := &model.User{
Email: model.NewId(), Email: model.NewId(),
DeleteAt: 0, DeleteAt: 0,
@@ -872,8 +870,6 @@ func TestUpdateExtrasByUser(t *testing.T) {
} }
Must(store.Channel().Save(&c2)) Must(store.Channel().Save(&c2))
t.Logf("c1.Id = %v", c1.Id)
u1 := &model.User{ u1 := &model.User{
Email: model.NewId(), Email: model.NewId(),
DeleteAt: 0, DeleteAt: 0,

Просмотреть файл

@@ -880,15 +880,13 @@ func TestPostCountsByDay(t *testing.T) {
o2a = Must(store.Post().Save(o2a)).(*model.Post) o2a = Must(store.Post().Save(o2a)).(*model.Post)
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
t.Log(t1.Id)
if r1 := <-store.Post().AnalyticsPostCountsByDay(t1.Id); r1.Err != nil { if r1 := <-store.Post().AnalyticsPostCountsByDay(t1.Id); r1.Err != nil {
t.Fatal(r1.Err) t.Fatal(r1.Err)
} else { } else {
row1 := r1.Data.(model.AnalyticsRows)[0] row1 := r1.Data.(model.AnalyticsRows)[0]
if row1.Value != 2 { if row1.Value != 2 {
t.Log(row1) t.Fatal(row1)
t.Fatal("wrong value")
} }
row2 := r1.Data.(model.AnalyticsRows)[1] row2 := r1.Data.(model.AnalyticsRows)[1]

Просмотреть файл

@@ -31,6 +31,7 @@ var CfgDiagnosticId = ""
var CfgHash = "" var CfgHash = ""
var CfgFileName string = "" var CfgFileName string = ""
var ClientCfg map[string]string = map[string]string{} var ClientCfg map[string]string = map[string]string{}
var originalDisableDebugLvl l4g.Level = l4g.DEBUG
func FindConfigFile(fileName string) string { func FindConfigFile(fileName string) string {
if _, err := os.Stat("./config/" + fileName); err == nil { if _, err := os.Stat("./config/" + fileName); err == nil {
@@ -56,11 +57,16 @@ func FindDir(dir string) string {
} }
func DisableDebugLogForTest() { func DisableDebugLogForTest() {
l4g.Global["stdout"].Level = l4g.WARNING if l4g.Global["stdout"] != nil {
originalDisableDebugLvl = l4g.Global["stdout"].Level
l4g.Global["stdout"].Level = l4g.WARNING
}
} }
func EnableDebugLogForTest() { func EnableDebugLogForTest() {
l4g.Global["stdout"].Level = l4g.DEBUG if l4g.Global["stdout"] != nil {
l4g.Global["stdout"].Level = originalDisableDebugLvl
}
} }
func ConfigureCmdLineLog() { func ConfigureCmdLineLog() {