I have a library that is used by cross platform binaries running in corp. 
Some of these binaries don't necessary run google.Init.

My library is using base/go/log package but this doesn't work when 
google.Init isn't called. It prints to stderr with a message "ERROR: 
logging before google.Init". This crashes windows services which crash if 
there is anything written to stdout or stderr.

My first thought was to have the callers provide a standard log.Logger 
instance which could be used instead of the base/go/log package. Most 
binaries could use the base/go/log NewStandardLogger function to get this. 
While windows services could have a logger instance which just writes out 
to ioutil.Discard. The downside is I will need multiple *log.Logger 
instances for different log levels which doesn't seem great.  

Is there a better way to do this? 


-- 
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/8f828309-c8bb-4728-98dc-7dc9fb6d0459n%40googlegroups.com.

Reply via email to