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
Remove explicit Logger
class verification
#1181
Conversation
👋 @bartekbsh, thank you very much for you contribution! We have some test around this logic here: dd-trace-rb/spec/ddtrace/configuration/settings_spec.rb Lines 282 to 314 in 5bd0dba
Would you mind adding tests that covers the ability to set any arbitrary object as a logger? |
Hey @marcotc! I'll add the test later today. |
I have decided to use double with logger-like interface in spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for you contribution @bartekbsh! 🎉
👋 @bartekbsh This has been released in 0.41.0 https://github.com/DataDog/dd-trace-rb/releases/tag/v0.41.0, thanks again for the contribution! |
This PR addresses problematic check in setter configuration that disallows using loggers that are not ruby
::Logger
descendants. Current behavior not only doesn't allow using certain loggers (e.g.semantic_logger
orlogging
) without dirty hacks, but also silently ignores setting value that does not match this validation.I tried finding common behavior of more popular logging libraries to introduce idiomatic duck-typing instead of current class comparison, but there doesn't seem to be anything simple enough (apart from validating presence of all methods that
dd-trace
uses) -- commonly found methods#add
and#log
are not always present, and they are not always public.I didn't find any test that would validate that only
Logger
descendants can be used, so I didn't introduce any changes to existing specs. Please let me know if you think, that's something worth verifying.