(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestNewWriter(t *testing.T) { |
| 20 | buf := bytes.Buffer{} |
| 21 | w := diode.NewWriter(&buf, 1000, 0, func(missed int) { |
| 22 | fmt.Printf("Dropped %d messages\n", missed) |
| 23 | }) |
| 24 | log := zerolog.New(w) |
| 25 | log.Print("test") |
| 26 | |
| 27 | w.Close() |
| 28 | want := "{\"level\":\"debug\",\"message\":\"test\"}\n" |
| 29 | got := cbor.DecodeIfBinaryToString(buf.Bytes()) |
| 30 | if got != want { |
| 31 | t.Errorf("Diode New Writer Test failed. got:%s, want:%s!", got, want) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestClose(t *testing.T) { |
| 36 | buf := bytes.Buffer{} |