vanilla_test.go (481B)
1 package logging 2 3 import ( 4 "bytes" 5 "testing" 6 ) 7 8 func TestVanilla(t *testing.T) { 9 logg := NewVanilla().WithDomain("test").WithLevel(LVL_WARN) 10 w := bytes.NewBuffer(nil) 11 logg.Writef(w, LVL_DEBUG, "message", "xyzzy", 666, "inky", "pinky") 12 if len(w.Bytes()) > 0 { 13 t.Errorf("expected nothing, got %s", w.Bytes()) 14 } 15 logg = logg.WithLevel(LVL_DEBUG) 16 logg.Writef(w, LVL_DEBUG, "message", "xyzzy", 666, "inky", "pinky") 17 if len(w.Bytes()) == 0 { 18 t.Errorf("expected output") 19 } 20 }