You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a package importing "gopkg.in/inconshreveable/log15.v2" imports another package which also uses "gopkg.in/inconshreveable/log15.v2", then any calls to l.SetHandler(...) for any logger will overwrite the handler in all loggers across both of those packages.
The reason is that there's a shared root in the package which always references the same underlying log.Handler even after calling l.New() on it.
Your documentation suggests initializing logging like this:
I tried this method and got burned because both my main package and my library imported "gopkg.in/inconshreveable/log15.v2". Suddenly my logs were gone because the library changed the singular root logger's handler to log.DiscardHandler.
I recommend changing the semantics of log15.New() to do a completely new object without a shared Root at the bottom, while allowing Logger.New() to perform shared state chaining.
The text was updated successfully, but these errors were encountered:
If a package importing
"gopkg.in/inconshreveable/log15.v2"
imports another package which also uses"gopkg.in/inconshreveable/log15.v2"
, then any calls tol.SetHandler(...)
for any logger will overwrite the handler in all loggers across both of those packages.The reason is that there's a shared
root
in the package which always references the same underlyinglog.Handler
even after callingl.New()
on it.Your documentation suggests initializing logging like this:
I tried this method and got burned because both my main package and my library imported
"gopkg.in/inconshreveable/log15.v2"
. Suddenly my logs were gone because the library changed the singular root logger's handler tolog.DiscardHandler
.I recommend changing the semantics of
log15.New()
to do a completely new object without a shared Root at the bottom, while allowingLogger.New()
to perform shared state chaining.The text was updated successfully, but these errors were encountered: