-
Notifications
You must be signed in to change notification settings - Fork 258
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
Using logrus as the custom logger #93
Comments
Today I stumbled upon that as well. Apparently the interfaces do not match and I could not manage to get it to work without creating a wrapper for logrus, which is fine but kinda not what I expected. Here is what I got (same thing with other methods):
I don't know if there is a standard for logging interfaces in go, but logrus is pretty common and it would be nice to find a way to ease the integration without harming potential integration with other logging interfaces. |
@danielezer here's what I've done: retryClient.Logger = log.New(ioutil.Discard, "", log.LstdFlags)
retryClient.RequestLogHook = func(_ retryablehttp.Logger, req *http.Request, attempt int) {
logger.WithFields(logrus.Fields{
"request": map[string]string{
"proto": req.Proto,
"host": req.URL.Host,
"path": req.URL.Path,
},
"attempt": attempt,
}).Info("Sending request")
} |
In case it helps anybody, I've made small changes in PR #101 to add a logger interface compatible with logrus "Printf-like" methods. |
This is not assigned after quite some time. Is anyone going to work on this? Even if it is't logrus that is used, the fact that there are DEBUG messages I cannot turn off without some hack is pretty bad. Can someone at least acknowledge this ticket? |
@spykermj This is clearly an issue and should be assigned. I'm not a maintainer but I'm sure they will hopefully be able to get to it soon |
Is it possible to use a logrus logger as the custom logger?
When I try, it seems like the logger is not used as a LeveledLogger, which is what I was expecting
The text was updated successfully, but these errors were encountered: