| 835 | } |
| 836 | |
| 837 | func TestDiscard(t *testing.T) { |
| 838 | out := &bytes.Buffer{} |
| 839 | log := New(out) |
| 840 | log.Log().Discard().Str("a", "b").Msgf("one %s %.1f %d %v", "two", 3.4, 5, errors.New("six")) |
| 841 | if got, want := decodeIfBinaryToString(out.Bytes()), ""; got != want { |
| 842 | t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want) |
| 843 | } |
| 844 | |
| 845 | // Double call |
| 846 | log.Log().Discard().Discard().Str("a", "b").Msgf("one %s %.1f %d %v", "two", 3.4, 5, errors.New("six")) |
| 847 | if got, want := decodeIfBinaryToString(out.Bytes()), ""; got != want { |
| 848 | t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want) |
| 849 | } |
| 850 | } |
| 851 | |
| 852 | type levelWriter struct { |
| 853 | ops []struct { |