Created
August 11, 2019 14:52
-
-
Save mhewedy/63d243e8ef84ac23c740aabba9ac3f32 to your computer and use it in GitHub Desktop.
Simple Tee writer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TeeWriter struct { | |
w []io.Writer | |
} | |
func (t TeeWriter) Write(p []byte) (n int, err error) { | |
for _, writer := range t.w { | |
n, err = writer.Write(p) | |
if err != nil { | |
return n, err | |
} | |
} | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: