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

Function TestMultiWrite

journald/journald_test.go:98–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestMultiWrite(t *testing.T) {
99 var (
100 w1 = new(bytes.Buffer)
101 w2 = new(bytes.Buffer)
102 w3 = NewJournalDWriter()
103 )
104
105 zerolog.ErrorHandler = func(err error) {
106 if err == io.ErrShortWrite {
107 t.Errorf("Unexpected ShortWriteError")
108 t.FailNow()
109 }
110 }
111
112 log := zerolog.New(io.MultiWriter(w1, w2, w3)).With().Logger()
113
114 for i := 0; i < 10; i++ {
115 log.Info().Msg("Tick!")
116 }
117}
118
119func TestWriteWithVariousTypes(t *testing.T) {
120 mock := &mockSend{}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
NewJournalDWriterFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
InfoMethod · 0.65

Tested by

no test coverage detected