func TestTagged(t *testing.T) { //create buffer log, buf := createLogger() log.Print("footag", "foo") compare(t, buf, "") log.Enable("footag") log.Print("footag", "foo") compare(t, buf, "foo\n") log.Print("bartag", "bar") compare(t, buf, "") log.Enable("bartag") log.Print("bartag", "bar") compare(t, buf, "bar\n") }
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, "") }
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, "") }