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

Function MultiLevelWriter

writer.go:127–137  ·  view source on GitHub ↗

MultiLevelWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command. If some writers implement LevelWriter, their WriteLevel method will be used instead of Write.

(writers ...io.Writer)

Source from the content-addressed store, hash-verified

125// provided writers, similar to the Unix tee(1) command. If some writers
126// implement LevelWriter, their WriteLevel method will be used instead of Write.
127func MultiLevelWriter(writers ...io.Writer) LevelWriter {
128 lwriters := make([]LevelWriter, 0, len(writers))
129 for _, w := range writers {
130 if lw, ok := w.(LevelWriter); ok {
131 lwriters = append(lwriters, lw)
132 } else {
133 lwriters = append(lwriters, LevelWriterAdapter{w})
134 }
135 }
136 return multiLevelWriter{lwriters}
137}
138
139// TestingLog is the logging interface of testing.TB.
140type TestingLog interface {

Callers 5

TestMultiSyslogWriterFunction · 0.85
TestResilientMultiWriterFunction · 0.85

Calls

no outgoing calls

Tested by 5

TestMultiSyslogWriterFunction · 0.68
TestResilientMultiWriterFunction · 0.68