What’s the best multiplatform logging solution that people are using? One of the things I always en...
s
What’s the best multiplatform logging solution that people are using? One of the things I always enjoyed about
Timber
is that you could swap out the actual logging implementation so that you could route all logs into something like Crashlytics.
a
It depends on the targets. If You have to works with native - I suggest to use https://github.com/MicroUtils/kotlin-logging or https://github.com/touchlab/Kermit I know nothing about JS target
j
I keep meaning to finish Timber 5 which is MPP, but it's just not a huge priority
😍 21
I use a snapshot in a MPP app, but I wouldn't recommend that
e
I have this, in anticipation of Timber 5:
Copy code
expect object Timber {
  fun e(message: String)
  fun e(t: Throwable, message: String)
  fun w(message: String)
  fun w(t: Throwable, message: String)
  fun d(message: String)
  fun v(message: String)
}
but i don’t actually have a web/iOS impl yet so
j
Those are really, really easy. You just forward to
console and NSLog what the fuck Slack you had one job...
😂 15
a
https://github.com/AAkira/Napier is very similar to timber and allow swap logger implementation
On https://libs.kmp.icerock.dev/ available 9 log libs (category logging)
a
Oh… kotlin-logging has no androidJvm. I’ve forget it. We have androidJvm target and use kermit.
j
Have used https://github.com/touchlab/Kermit in a few projects but haven't done comparison in a while on what else is available
r
For Kotlin Multiplaform logging I could not find a library that had all the features I needed so I ended up writing one. Please check out KmLogging. The features it implements is: • Uses platform specific logging on each platform: Log on Android, os_log on iOS, and console on JavaScript. • High performance. Only 1 boolean check when disabled. I like to put in lots of logging and want all of it turned off for release builds and do not want to pay much overhead for having lots of logging. Also, when logging is on it needs to be really performant. • Extensible. Need to be able add other loggers such as logging to Crashlytics, etc. • Each logger can log at a different level. For example, you may only want info and above going to Crashlytics and all other loggers disabled in production.
d
@jw did you document somewhere what’s missing to make Timber KMM ready for release? I see a branch
five
— are you still using a snapshot or did you switch to another library and abandon Timber?
j
I don't have any multiplatform apps such that I need it so it's at the bottom of the priority list
2800 Views