-
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
Added LeveledFormatLogger (Printf-like logger) #101
base: main
Are you sure you want to change the base?
Conversation
LGTM but needs CLA signed and would like @evanphx to take a look as well since he does more maintaining here. |
Signed-off-by: Juan Manuel Fresia <juanmanuelfresia@gmail.com>
Signed-off-by: Juan Manuel Fresia <juanmanuelfresia@gmail.com>
3d9bf28
to
097581e
Compare
Thanks @jefferai, I've signed the CLA, and rebased the changes to master. |
Hi :) Any news on this Pull Request merge ETA ? |
Maybe @evanphx could take a look? |
I suppose this is fine, though I worry about having this massive footprint of different logging interfaces embedded in a simple package. |
w.r.t many libraries have logr compatible interface, which would be yet another interface. |
Hi, any plans of getting this merged anytime soon? :) |
Wrapper inspired by hashicorp/go-retryablehttp#101 (comment).
Wrapper inspired by hashicorp/go-retryablehttp#101 (comment).
I'm also interested in this. |
@ryanuber Any chance to merge and publish it? |
Any news on this? |
Hi @ryanuber could take a look? |
Any update on this? Would be very helpful |
Hey, would be helpful to have this support. |
cc @ryanuber any eta on this? |
Same I am also interested, so far we disable completely the logging on this lib as it's unuseable. |
This looks like a pretty simple change that would help a lot of people. Any chance of it getting merged? |
@jwlv @kedare etc. did you try the little adapter posted just above? #101 (comment) |
@greut thanks for the pointer. It worked great! |
Unfortunately I don't work with go anymore :( |
I am really interested in having this added! |
Would be helpful if this was eventually merged :) |
Hi everyone!
I was having a hard time trying to use
logrus
logger interface to work with go-retryablehttp, having no other choice that to implement a wrapper to align the two interfaces. Also, I was not the first to attempt stumble upon this (see #93).Changes
So I tried to add support in go-retryablehtp for interfaces like logrus logger, which uses the
Printf
family of functions to output formatted logs (there is one for each level:Infof
,Debugf
, etc).The change is generic (it is not tied to logrus), and it only adds a new logger interface called
LeveledFormatLogger
, which is similar toLeveledLogger
but uses thePrintf
style for formatting and adding arguments to the logs.A wrapper was provided to use the new interface as a simple
Logger
(hookFormatLogger), and all log lines have now an alternative withLeveledFormatLogger
.Example
Here is an example of the output with the changes:
As opposed to the same output while using logrus as a default
Logger
This is what I'm currently using, and given it is a small change I thought it could be interesting to bring it upstream. Let me know what you think!
Signed-off-by: Juan Manuel Fresia juanmanuelfresia@gmail.com