KMLogging for logging on Kotlin Multiplatform

Andrea
1 min readFeb 18, 2024

As I learn on KMM/KMP for cross platform mobile app. I has realised that so much thing on Android framework that we take it for granted.

For example logging library. On Android logging will be easy with just log.i or log.d Or if you need even more advanced library we can use Timber.

Not so easy with KMM/KMP where the user for this technology is not popular yet. There is only limited logging library for this framework.

The one I used currently is KMLogging .

Mainly used in CommonMain folder where the shared Bussiness Logic is developed.

Inside the class where we want to use logging, create property/ object for the tag.

val log = logging("KMLogging Tag")

And whenever when to log :

...
log.info { "logging info 1" }
...

I havent explore other logging library for KMP. For now, this library is sufficient for my need.

--

--