(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestWithLevel(t *testing.T) { |
| 15 | var buf bytes.Buffer |
| 16 | l := log.NewLogfmtLogger(&buf) |
| 17 | ll := WithLevel(l) |
| 18 | ll.Debug("hi") |
| 19 | // ensure the caller depth is correct |
| 20 | assert.Contains(t, buf.String(), "caller=log_test.go") |
| 21 | assert.Contains(t, buf.String(), "level=debug") |
| 22 | |
| 23 | ll.Debugw("foo", "bar", "baz") |
| 24 | assert.Contains(t, buf.String(), "bar=baz") |
| 25 | |
| 26 | ll.Debugf("foo%d", 1) |
| 27 | assert.Contains(t, buf.String(), "foo1") |
| 28 | } |
| 29 | |
| 30 | func TestLevelFilter(t *testing.T) { |
| 31 | var buf bytes.Buffer |