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
ability to create custom logger factories to make non-SLF4J implementations #121
Conversation
…lementations * Remove SLF4J interface dependency for KLogger in Java to allow for non SLF4J implementations
What do you think about taking a different approach and having another sub module for jvm android? This way you can implement it to call the android log itself directly. |
I toyed with that a bit but I felt this approach was more flexible and
didn't require making the core library dependent on Android directly
…On Mon, Jul 13, 2020, 5:10 PM Ohad Shai ***@***.***> wrote:
What do you think about taking a different approach and having another sub
module for jvm android? This way you can implement it to call the android
log itself directly.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC5YDVJDVQDMQNFPJNEQULR3NZ3NANCNFSM4OYSERCA>
.
|
I think it would make sense to have an android module that depends on Android. Not that the entire lib depend on android of course. |
I basically wrote that for my internal library. Can share some of the
source code if someone wanted to make an official module for it to publish.
Would have to do it in the morning tomorrow
…On Mon, Jul 13, 2020, 5:50 PM Ohad Shai ***@***.***> wrote:
I think it would make sense to have an android module that depends on
Android. Not that the entire lib depend on android of course.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC5YDTL4PZLWRNNOUCMWWDR3N6RDANCNFSM4OYSERCA>
.
|
Below is the promised code promised to @oshai using this to create an android module that depends on this if that was desired:
|
@thadcodes thanks for the code sample, I created #122 with the suggestion raised here. Hope someone will pick it up. Other than that please let me know what would you like to do with this PR. |
Well I'm using my fork that has this pr in it personally and plan to keep
using it to get rid of the slf logger dependency for the klogger interface.
I'd like to see it merged into a branch for a 2.0 version since it's
breaking if someone is expecting klogger to extend the logger interface.
But I get the sense you are not a fan. What are your thoughts on it? If
you want to leave my fork as a fork I understand and will close the pr. If
you have suggestions on modifications that still remove the slf interface
from the jvm version then I'd love to discuss.
…On Thu, Jul 16, 2020, 5:23 PM Ohad Shai ***@***.***> wrote:
@thadcodes <https://github.com/thadcodes> thanks for the code sample, I
created #122 <#122>
with the suggestion raised here. Hope someone will pick it up. Other than
that please let me know what would you like to do with this PR.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC5YDRG4TZPJBBUYCNP7NLR35VWHANCNFSM4OYSERCA>
.
|
@thadcodes I think I get your point and see what you're trying to do. I think it is possible to do it without breaking changes by implementing a "custom" module. I don't see why The only issue is to what platform compile that module, but I think we can compile it to jvm, and later compile it to other platforms if needed. Hope it's clear, Let me know if you have any question. |
@oshai the part that makes this a breaking change is that the Actually the correct way in my view is that |
I am not sure I quite follow you. I am not 100% sure my solution is feasible. However, it feels to me that since multi platform might be change it's api in the future (maybe even with kotlin 1.4) it's not a good idea to introduce a concept based on a breaking change that we might not need / need to break again later to support. Maybe after 1.4 is being released it will make more sense to do so. |
I think for proper multi-platform |
I think the idea of
A new android module or common module with custom injected logger should not depend on |
I don't feel it's clear that "android" is a platform in MPP. I think this is just allowing some details on how it creates the assets and publishes as an Android library but I'm not sure. I've tried a bit to verify but I can't seem to get it working. Will keep on trying but just wanted to let you know i have not ignored this. |
@oshai I'm not going to have the time to get android dependencies to work at this time in the actual project but I see your argument. I'll close this PR and either I or someone else will work on that change at a later time |
Thanks for the update and the effort done so far. Hope you will have time to get back to it in the future. |
See updates on #122 on how to solve the issue. |
A proposal for a change that is slightly breaking but allows consumers to create their own kLogger implementations for custom logging environments. My use-case is for Android apps the SLF4J-Android implementation is deprecated and badly formats exceptions and cuts off most of the stack trace so I used this to have an implementation that in an Android app simply calls the Log.x functions.
For simplicity it also is a breaking change as it removes the SLF4J logger base interface from KLogger in JVM so I proposed a 2.0 version. Interested to hear any feedback