Make short work of your logs!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
630 B

package beaver
import "testing"
func TestParseLevel(t *testing.T) {
tt := []struct {
Parse string
Expected Level
{"T", TRACE},
{"Trace", TRACE},
{"D", DEBUG},
{"Debug", DEBUG},
{"I", INFO},
{"Info", INFO},
{"W", WARN},
{"Warn", WARN},
{"E", ERROR},
{"Error", ERROR},
{"F", FATAL},
{"Fatal", FATAL},
{"Unknown", INFO},
{"N/A", INFO},
{"1234", INFO},
{"A Space", INFO},
for _, tc := range tt {
t.Run(tc.Parse, func(t *testing.T) {
level := ParseLevel(tc.Parse)
if level != tc.Expected {
t.Logf("Expected `%s`, got `%s`", tc.Expected, level)