-
Notifications
You must be signed in to change notification settings - Fork 39
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
Logger interface #2
Conversation
Define Stdlogger interface and a global exported Logger instance, which aims to give flexibilty to applications, which integrate the sensor lib.
hi @manolovl , thanks a lot for the PR! Before we move forward with it, there is some things we should consider:
cheers pb |
Hi @pavlobaron, I see your point about separation of log levels, but frankly I wouldn't mix up sensor logs in the logs of the application, using it. I'd like have the Cheers, |
I also just edited the README, in case the PR would be approved. |
hi @manolovl , thanks, I thought about it. I don't think separating log level by string patterns solves what I mean, but I also get your points. What I'm thinking of is providing "mode" instead of log level in the opts when instantiating sensor/tracer, so I can use it not to debug-log if in "prod" mode, or only debug-log when in "dev" mode. This solves what you're after and what I was thinking of. WDYT? cheers pb |
In our other instrumented languages we just log a boot message and if everything goes well, we never print another thing. In case of error, we log a single message and handle the best we can. If not, we go sit in the corner and just not do anything. Other common requirements are:
So good points on both sides and it's the right idea but I think it would be best if we stay consistent with our other languages. It seems we may have to use a 3rd party logger or roll our own to meet the above. BTW it seems that there is a proposal to augment @manolovl I believe we are going to have to pass on this specific PR but I agree logging needs to be fixed in this package. I'd love to hear any other ideas/concerns/input you have on this. |
Filed #13 in response to this PR with requirements. Closing this PR. If any objections/concerns, please let me know. Thanks @manolovl ! |
No, not all. Meanwhile I also came to the conclusion that there would be good if to have a dedicated (and als default) logger, implementing certain interface, i.e. the one of Logrus, so it could be then swapped by the one, used in the env, where the sensor is being used. |
+1 on Logrus - looks really slick. |
Hi, since I saw you're open to PRs, I'd like to propose this refactoring of the logger from a very specific implementation into a global exported variable implementing a minimalistic interface. The reasons for the proposed change include the following: