-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logging to ease debugging connection reattempts #77
Comments
By default, all calls in mangos that use log.{Info,Infof,Debug,Debugf} would be noops. By importing a logger such as with I only added a single log usage to the main code where it was useful for me, but more could easily be added. |
@gdamore You've mentioned your aversion to adding dependencies to the project (logrus), if that is still the case then may I suggest we define an interface that defines hooks which we can then add to the library. What do you think? |
I'd be fine with a hook style interface. |
Background: I was setting up tls+tcp connection with mutual authentication. I didn't realize that I needed to provide a ServerName in the tls.Config, so mangos kept trying to reconnect, but I just saw this as a timeout occurring from my code. I eventually had to throw in print statements throughout
core.go
to find the cause.I propose adding a very simple logging solution.
My idea is to let users register loggers (like how
database/sql
registers drivers). A default one that logs to stderr could be provided in a mangos subpackage. I'll submit a PR with a proof of concept in just a minute. Using it would look like this:The text was updated successfully, but these errors were encountered: