From bfca752940a13c874788b0c885d36b2b263bd4fb Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Tue, 27 Sep 2016 07:07:32 -0700 Subject: [PATCH] Fixing the console level debug statements (#4092) --- api/admin_test.go | 1 - api/team_test.go | 4 +++- config/config.json | 2 +- store/sql_channel_store_test.go | 4 ---- store/sql_post_store_test.go | 4 +--- utils/config.go | 10 ++++++++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/api/admin_test.go b/api/admin_test.go index c758bd4fe6..445d2de385 100644 --- a/api/admin_test.go +++ b/api/admin_test.go @@ -154,7 +154,6 @@ func TestEmailTest(t *testing.T) { if _, err := th.SystemAdminClient.TestEmail(utils.Cfg); err == nil { t.Fatal("should have errored") } else { - println(err.Id) if err.Id != "api.admin.test_email.missing_server" { t.Fatal(err) } diff --git a/api/team_test.go b/api/team_test.go index 936ba696be..1a66a826ff 100644 --- a/api/team_test.go +++ b/api/team_test.go @@ -564,7 +564,9 @@ func TestGetTeamMembers(t *testing.T) { t.Fatal(err) } else { members := result.Data.([]*model.TeamMember) - t.Log(members) + if members == nil { + t.Fatal("should be valid") + } } } diff --git a/config/config.json b/config/config.json index dde4780894..44e52d88eb 100644 --- a/config/config.json +++ b/config/config.json @@ -55,7 +55,7 @@ "AtRestEncryptKey": "" }, "LogSettings": { - "EnableConsole": true, + "EnableConsole": false, "ConsoleLevel": "DEBUG", "EnableFile": true, "FileLevel": "INFO", diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go index 519fdea6a2..d7d99f581b 100644 --- a/store/sql_channel_store_test.go +++ b/store/sql_channel_store_test.go @@ -766,8 +766,6 @@ func TestGetMemberCount(t *testing.T) { } Must(store.Channel().Save(&c2)) - t.Logf("c1.Id = %v", c1.Id) - u1 := &model.User{ Email: model.NewId(), DeleteAt: 0, @@ -872,8 +870,6 @@ func TestUpdateExtrasByUser(t *testing.T) { } Must(store.Channel().Save(&c2)) - t.Logf("c1.Id = %v", c1.Id) - u1 := &model.User{ Email: model.NewId(), DeleteAt: 0, diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go index 594e923be4..6105cbace5 100644 --- a/store/sql_post_store_test.go +++ b/store/sql_post_store_test.go @@ -880,15 +880,13 @@ func TestPostCountsByDay(t *testing.T) { o2a = Must(store.Post().Save(o2a)).(*model.Post) time.Sleep(1 * time.Second) - t.Log(t1.Id) if r1 := <-store.Post().AnalyticsPostCountsByDay(t1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { row1 := r1.Data.(model.AnalyticsRows)[0] if row1.Value != 2 { - t.Log(row1) - t.Fatal("wrong value") + t.Fatal(row1) } row2 := r1.Data.(model.AnalyticsRows)[1] diff --git a/utils/config.go b/utils/config.go index 2c41130095..c67de906e3 100644 --- a/utils/config.go +++ b/utils/config.go @@ -31,6 +31,7 @@ var CfgDiagnosticId = "" var CfgHash = "" var CfgFileName string = "" var ClientCfg map[string]string = map[string]string{} +var originalDisableDebugLvl l4g.Level = l4g.DEBUG func FindConfigFile(fileName string) string { if _, err := os.Stat("./config/" + fileName); err == nil { @@ -56,11 +57,16 @@ func FindDir(dir string) string { } 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() { - l4g.Global["stdout"].Level = l4g.DEBUG + if l4g.Global["stdout"] != nil { + l4g.Global["stdout"].Level = originalDisableDebugLvl + } } func ConfigureCmdLineLog() {