Hey all, is it possible to use just the KLogger in...
# kotlin-logging
b
Hey all, is it possible to use just the KLogger interface/facade in a MPP library and let it be manually implemented on each platform? (I have an iOS target that I can't build for because kotlin-logging doesn't support it.)
o
Yes, I guess it is possible. A better approach will be to contribute it to the lib itself if possible.
there is currently a linux impl being worked on: https://github.com/MicroUtils/kotlin-logging/pull/119
the main obstacle is packaging it
b
Ok, so is there a version of the library with just the interface in it?
Yeah, I don't know much about linux dev unfortunately.
o
the binaries are packed separately
kotlin-logging-common
is the common artifact
b
If I only include kotlin-loggin-common in commonMain I get
Unresolved reference: KLogger
when I try and import mu.KLogger in my iosX64 target. I guess it isn't a pure kotlin dependency?
o
I never tried what you'r doing but you probably need to add the
expected
interface. ie you have to implement the ios module yourself. see js for example: https://github.com/MicroUtils/kotlin-logging/blob/master/src/jsMain/kotlin/mu/KLogger.kt
b
Hmm, now I'm getting
Actual interface 'KLogger' has no corresponding expected declaration.
I guess I should probably just create a custom logging interface for my project.
o
maybe it's not the same package name?
b
Using
package mu
Just copied and pasted the class you sent. Also, using version 1.7.8 if that matters. I have no mu dependency in my iosMain, just the kotlin-logging-common in my commonMain.
o
well, then maybe it is not possible. you can ask in #multiplatform maybe someone will know
b
Ok. Sounds good. Thanks for the help.
o
see also similar question on github: https://github.com/MicroUtils/kotlin-logging/pull/121