MCPcopy
hub / github.com/rs/zerolog / ExampleNewWriter

Function ExampleNewWriter

diode/diode_example_test.go:13–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11)
12
13func ExampleNewWriter() {
14 w := diode.NewWriter(os.Stdout, 1000, 0, func(missed int) {
15 fmt.Printf("Dropped %d messages\n", missed)
16 })
17 log := zerolog.New(w)
18 log.Print("test")
19
20 w.Close()
21
22 // Output: {"level":"debug","message":"test"}
23}

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
NewWriterFunction · 0.92
NewFunction · 0.92
PrintfMethod · 0.80
PrintMethod · 0.80

Tested by

no test coverage detected