https://kotlinlang.org logo
#touchlab-tools
Title
# touchlab-tools
r

ribesg

02/21/2024, 3:55 PM
I'm trying to setup Kermit in my app but I don't see logs on desktop, and I don't see it mentioned in the documentation. Is it supported? If it's not, is it normal that logs just silently fail on desktop?
k

kpgalligan

02/21/2024, 8:28 PM
"Desktop" being Compose UI on the JVM? This is using the default logger? For the JVM, the default is
SystemWriter
(https://github.com/touchlab/Kermit/blob/main/kermit-core/src/jvmMain/kotlin/co/touchlab/kermit/SystemWriter.kt), which should just print to stdout, unless the message is an error, in which case it should go to
System.error
. If this is an iOS app running inside the Android Studio plugin, the AS plugin ignores debug statements, and at the time we first looked at this, there was no way to change that. This did fall off the radar, I'll admit (issue: https://github.com/touchlab/Kermit/issues/380). We'd have to revisit some way to resolve it, but none of the resolutions that I can think of that don't involve the user customizing the logger config are very appealing. The AS plugin really should either have a config or show everything. It's possible the plugin has changed since, but as stated in the issue, I basically don't ever use it and haven't seen it in a while.
r

ribesg

02/22/2024, 9:16 AM
Oh yeah I'm totally talking about Compose on the JVM. I just added the dependency on common, added a
Logger.i{ "Hello" }
somewhere, saw it on Android but not when running the JVM main from IntelliJ IDEA. I think it's not an issue with Kermit but with the way IntelliJ run the main, I don't know, but now it seems to work. I think the JVM should be mentioned on the documentation. It clearly states: > On Android it writes to Logcat, on iOS it writes to OSLog, and for JS it writes to console. I understood that as "JVM is not supported". This page also lists writers and there's nothing about
SystemWriter
. Also, a custom writer using SLF4J on the JVM would be a great example of a custom logwriter implementation for documenting how to do that.
k

kpgalligan

02/22/2024, 5:20 PM
Well, if I'm being honest, we're not running in the JVM very much around here. Almost always Android or iOS. Will need to have somebody look at that a bit.
r

ribesg

02/22/2024, 10:52 PM
I really use it because it's much faster to start than android or ios
k

kpgalligan

02/23/2024, 5:14 PM
I am currently working on a project that does that, but not for compose. Just JVM for logic and tests. It certainly is much smoother.
r

ribesg

02/23/2024, 6:45 PM
It's also interesting to see differences between platforms with Compose, I don't have any between iOS and Android for now, and I'm not sure I'll have any, but I added scrollbars for the JVM, to see how that would work. I also just open sourced an early version of my demo project https://github.com/wizbii/WatchOrder
8 Views