From f85330a4b532a6f1c69c6fd09566e79dd665e653 Mon Sep 17 00:00:00 2001 From: Kanshi Date: Mon, 6 May 2019 02:25:52 -0400 Subject: [PATCH] Modifying test and benchmarks to match log level order (#19) * Fixing log level order Log level order was incorrect: debug was before info. This manifests in not having Info log not displayed when setting log level to debug. * Updating test to match log level order Also changed benchmark for consistency https://github.com/apsdehal/go-logger/pull/18 * Modifying benchmark log level order for consistency --- logger_test.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/logger_test.go b/logger_test.go index 2b1d007..f063934 100644 --- a/logger_test.go +++ b/logger_test.go @@ -26,12 +26,8 @@ func BenchmarkLoggerLog(b *testing.B) { "Critical Logging", }, { - InfoLevel, - "Info Logging", - }, - { - DebugLevel, - "Debug logging", + ErrorLevel, + "Error logging", }, { WarningLevel, @@ -42,8 +38,12 @@ func BenchmarkLoggerLog(b *testing.B) { "Notice Logging", }, { - ErrorLevel, - "Error logging", + InfoLevel, + "Info Logging", + }, + { + DebugLevel, + "Debug logging", }, } @@ -108,16 +108,16 @@ func TestInitColors(t *testing.T) { Green, "\033[32m", }, - { - DebugLevel, - Cyan, - "\033[36m", - }, { InfoLevel, White, "\033[37m", }, + { + DebugLevel, + Cyan, + "\033[36m", + }, } for _, test := range tests { @@ -239,14 +239,14 @@ func TestLogLevel(t *testing.T) { NoticeLevel, "Notice Logging", }, - { - DebugLevel, - "Debug logging", - }, { InfoLevel, "Info Logging", }, + { + DebugLevel, + "Debug logging", + }, } var buf bytes.Buffer @@ -262,8 +262,8 @@ func TestLogLevel(t *testing.T) { log.Error("Log Error") log.Warning("Log Warning") log.Notice("Log Notice") - log.Debug("Log Debug") log.Info("Log Info") + log.Debug("Log Debug") // Count output lines from logger count := strings.Count(buf.String(), "\n")