Exemplo n.º 1
0
func TestDisableTag(t *testing.T) {
	log, buf := createLogger()

	log.Enable("footag")
	log.Print("footag", "foo")
	compare(t, buf, "foo\n")

	log.Disable("footag")
	log.Print("footag", "foo")
	compare(t, buf, "")
}
Exemplo n.º 2
0
func TestMultitag(t *testing.T) {
	log, buf := createLogger()

	log.Enable("footag")
	log.Enable("bartag")
	log.Print("notag, other", "foo")
	compare(t, buf, "")

	log.Print("notag, footag", "foo")
	compare(t, buf, "foo\n")

	log.Print("footag, bartag", "foo")
	compare(t, buf, "foo\n")

	log.Print("footag,bartag", "foo")
	compare(t, buf, "foo\n")

	log.Disable("footag,bartag")
	log.Print("footag", "foo")
	compare(t, buf, "")
	log.Print("bartag", "foo")
	compare(t, buf, "")
}