Package list golang-github-go-kit-kit / 11fca2c
log/levels: improve test coverage Peter Bourgon 6 years ago
1 changed file(s) with 10 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2828 if want, have := "level=error msg=\"© violation\"\n", buf.String(); want != have {
2929 t.Errorf("want %#v, have %#v", want, have)
3030 }
31
32 buf.Reset()
33 logger.Crit("msg", " ")
34 if want, have := "level=crit msg=\"\\t\"\n", buf.String(); want != have {
35 t.Errorf("want %#v, have %#v", want, have)
36 }
3137 }
3238
3339 func TestModifiedLevels(t *testing.T) {
3642 log.NewJSONLogger(&buf),
3743 levels.Key("l"),
3844 levels.DebugValue("dbg"),
45 levels.InfoValue("nfo"),
46 levels.WarnValue("wrn"),
47 levels.ErrorValue("err"),
48 levels.CritValue("crt"),
3949 )
4050 logger.With("easter_island", "176°").Debug("msg", "moai")
4151 if want, have := `{"easter_island":"176°","l":"dbg","msg":"moai"}`+"\n", buf.String(); want != have {