2018-03-28 18:49:41 +00:00
|
|
|
// +build !binary_log
|
|
|
|
|
|
|
|
package diode_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/rs/zerolog"
|
|
|
|
"github.com/rs/zerolog/diode"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ExampleNewWriter() {
|
2018-10-31 23:57:15 +00:00
|
|
|
w := diode.NewWriter(os.Stdout, 1000, 0, func(missed int) {
|
2018-03-28 18:49:41 +00:00
|
|
|
fmt.Printf("Dropped %d messages\n", missed)
|
2018-05-25 01:50:57 +00:00
|
|
|
})
|
2018-03-28 18:49:41 +00:00
|
|
|
log := zerolog.New(w)
|
|
|
|
log.Print("test")
|
|
|
|
|
|
|
|
w.Close()
|
|
|
|
|
|
|
|
// Output: {"level":"debug","message":"test"}
|
|
|
|
}
|