77db4b4f35
This commit introduces a breaking change in the diode API in order to hide the diodes package interface. This removes a good number of dependencies introduced by the test framework used by the diodes package.
25 lines
392 B
Go
25 lines
392 B
Go
// +build !binary_log
|
|
|
|
package diode_test
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/diode"
|
|
)
|
|
|
|
func ExampleNewWriter() {
|
|
w := diode.NewWriter(os.Stdout, 1000, 10*time.Millisecond, func(missed int) {
|
|
fmt.Printf("Dropped %d messages\n", missed)
|
|
})
|
|
log := zerolog.New(w)
|
|
log.Print("test")
|
|
|
|
w.Close()
|
|
|
|
// Output: {"level":"debug","message":"test"}
|
|
}
|