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.
 
 

39 lines
780 B

package beaver
import (
"fmt"
"testing"
)
func TestConsole(t *testing.T) {
Console.Writer = testBuffer
tt := []struct {
Name string
Level Level
}{
{Name: "Trace Level", Level: TRACE},
{Name: "Debug Level", Level: DEBUG},
{Name: "Info Level", Level: INFO},
{Name: "Warn Level", Level: WARN},
{Name: "Error Level", Level: ERROR},
{Name: "Fatal Level", Level: FATAL},
}
for _, tc := range tt {
t.Run(tc.Name, func(t *testing.T) {
for _, lvl := range Levels() {
Console.Level = tc.Level
t.Run(fmt.Sprintf("%s Log", lvl), func(t *testing.T) {
Log(lvl, MESSAGE)
check(t, tc.Level, lvl)
})
t.Run(fmt.Sprintf("%s Logf", lvl), func(t *testing.T) {
Logf(lvl, "%s", MESSAGE)
check(t, tc.Level, lvl)
})
}
})
}
}