Open rhcarvalho opened 4 years ago
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
A global
Logger
in a library likesentry-go
poses some problems.log
package from Go's standard library, where user may want to use a different logging library (unfortunately, the stdlib has its shortcomings in this case). People should be free to use whatever logging framework they want (and possibly already use in theirmain
package), be itlog
,go.uber.org/zap
,github.com/golang/glog
,k8s.io/klog
,github.com/sirupsen/logrus
, ..., the list is really long ⇒ awesome-go#logging.Logger
makes it harder to test.Random thoughts
Our logging usage is small. There are <30 calls to
Logger.Print*
. Possibly all messages would fit a "INFO" level (but we can leave that to packagemain
, i.e. users, to decide what logging facility to use). We may or may not embrace some form of structured logging.One way to allow users of
sentry-go
to plug-in their own loggers is to make the SDK depend on a simple interface that can be easily implemented by actual loggers.At the moment we log from client and transport, hub and scope, and integrations (perhaps oddly including the
fasthttp
integration). We may need to change some of those log calls.A call to
sentry.Init
might take a logger and share it with components it initializes: the default integrations, client, transport, hub, scope, etc.We may provide a simple way to write to
os.Stderr
(see #154) for easy debugging.Resources
Posts in golang-nuts. https://groups.google.com/forum/#!topic/golang-dev/F3l9Iz1JX4g https://groups.google.com/d/msg/golang-dev/F3l9Iz1JX4g/rLIZvGvZBgAJ ⇒ https://golang.org/pkg/net/http/httptrace/ =>