On Wed, May 6, 2020 at 8:44 AM Kevin Chadwick <m8il1i...@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

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXofEhRZOEisdfGU2mfo8-vE07OxQpQP5vu2aaoGzdq4w%40mail.gmail.com.

Reply via email to