On Wed, May 6, 2020 at 8:44 AM Kevin Chadwick <
m8il...@gmail.com> wrote:
>
> "
https://godoc.org/log#SetOutput":
> "SetOutput sets the output destination for the standard logger."
>
> To me, without clarification, I assumed it would be globally re-directable at
> multiple times if desired, but it is only globally effective when ran early from
> main.
>
> I don't understand why it is designed this way? If you want package level log
> re-direction. I would have thought customisation, a flag switch or multiple
> processes communicating would make more sense than the current stdlib design.
>
> Is a log.SetGlobalOutput addition possible?
>
> Rather than people forking stdlib log...!
Sorry, can you show an example of what you mean? As far as I can
tell, you can call log.SetOutput multiple times, and it will affect
all subsequent output of the standard logger, up to the next call to
log.SetOutput.
Logging in general is of course a complicated subject. There have
been some attempts to improve the standard library's logging
capabilities, but they have all foundered because there are too many
different requirements and nobody has figured out how to write one
package that works for everyone. So we have the fairly simple
standard library log package, and there are many third party log
packages that provide different capabilities.
Ian