-
Notifications
You must be signed in to change notification settings - Fork 26
Recipe to convert parametrized JUL calls to slf4j #160
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
Conversation
src/main/java/org/openrewrite/java/logging/slf4j/LoggerParametrizedArguments.java
Outdated
Show resolved
Hide resolved
…rizedArguments.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Great work again @woj-tek ; I've already pushed up some polishing commits, mostly to help guide the implementation. You'll notice that the tests still fail due to a lingering Log.Level import; that's because there's likely a left over type reference on the method returned. I suspect this will be because we do not change the argument types. I've also added another test to indicate that we should not change the effectively logged argument order. Both issues are easiest to resolve if we switch to using JavaTemplate, with an appropriate classpath entry for SLF4J, to compose the new method to return. That should set the right type on the generated method, and gives you flexibility in reordering the arguments. |
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.
Thanks for getting this started @woj-tek ! There were some fun little edge cases, but I think we mostly got it working now. Let me know how this works for you based on our snapshot versions
Sorry, I was carried away with other tasks ans couldn't take a look at this - and kinda got stuck with JavaTemplates. Btw. do you think it would be possible to create simplified API for template akin to slf4j parametrised calls with template being
I checked it and it seems I missed one call with Exception (
I'll update/add test cases for those as well. |
As to the JavaTemplate proposal above, we do already support |
What's changed?
Recipe to convert parametrized JUL Logger calls to slf4j and enabled relevant unit-test
What's your motivation?
Continuing work on #155
Anything in particular you'd like reviewers to focus on?
Initial draft PR as suggested by Tim
Anyone you would like to review specifically?
@timtebeek
Checklist