Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: log: modify `Logger` struct, make it supports multi output #33454
What version of Go are you using (
This is still a backwards-incompatible change; SetOutput used to replace the writer, while in your CL above it appends.
I agree with @tmthrgd that you should simply use an io.MultiWriter here. Having one way to achieve something with less API is simpler than having many ways to do the same.
As others have said, this is a backwards incompatible change, which makes it not something we can accept. Most people who use I/O in Go for a while end up finding io.MultiWriter to be direct, simple, and natural. I would suggest using it and finding out.
Note that you can build up the "add a new output to an existing logger" pattern for yourself by using
If that's something you do all the time, you could put it in your own library.
Closing because it is a backwards-incompatible change with an easy implementation outside the standard library.