Skip to content

Commit

Permalink
Modifying test and benchmarks to match log level order (apsdehal#19)
Browse files Browse the repository at this point in the history
* 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
apsdehal#18

* Modifying benchmark log level order for consistency
  • Loading branch information
Kanshiroron authored and apsdehal committed May 6, 2019
1 parent cdc27a2 commit f85330a
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions logger_test.go
Expand Up @@ -26,12 +26,8 @@ func BenchmarkLoggerLog(b *testing.B) {
"Critical Logging",
},
{
InfoLevel,
"Info Logging",
},
{
DebugLevel,
"Debug logging",
ErrorLevel,
"Error logging",
},
{
WarningLevel,
Expand All @@ -42,8 +38,12 @@ func BenchmarkLoggerLog(b *testing.B) {
"Notice Logging",
},
{
ErrorLevel,
"Error logging",
InfoLevel,
"Info Logging",
},
{
DebugLevel,
"Debug logging",
},
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit f85330a

Please sign in to comment.