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)
| 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. |
| 127 | func 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. |
| 140 | type TestingLog interface { |
no outgoing calls