# Kermit and Crashlytics

DevFeed: [Kermit and Crashlytics](<https://devfeed.tech/articles/kermit-and-crashlytics-25948.md>)

Original publisher: [Read original article](<https://medium.com/@kpgalligan/kermit-and-crashlytics-27d7bc953576?source=rss-c2f810aa7890------2>)

Author: Kevin Galligan

Published: 2022-01-05T19:59:46Z

Content type: tutorial

Language: en

Sources: [Kevin Galligan](<https://devfeed.tech/sources/stories-by-kevin-galligan-on-medium.md>)

Topics: [Crashlytics](<https://devfeed.tech/topics/crashlytics.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [mobile-app-development](<https://devfeed.tech/topics/mobile-app-development.md>), [Library](<https://devfeed.tech/topics/library.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [crash-reporting](<https://devfeed.tech/tags/crash-reporting.md>), [crashlytics](<https://devfeed.tech/tags/crashlytics.md>), [ios](<https://devfeed.tech/tags/ios.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kermit](<https://devfeed.tech/tags/kermit.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [logging](<https://devfeed.tech/tags/logging.md>), [mobile-app](<https://devfeed.tech/tags/mobile-app.md>), [mobile-app-development](<https://devfeed.tech/tags/mobile-app-development.md>), [monitoring](<https://devfeed.tech/tags/monitoring.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [production](<https://devfeed.tech/tags/production.md>), [reporting](<https://devfeed.tech/tags/reporting.md>)

## AI overview

Kermit lets shared Kotlin Multiplatform code send logs to Crashlytics, with platform-specific setup and configuration. Its log writer sends messages at or above INFO by default; exception logs at or above WARN also create handled reports. On iOS, an uncaught Kotlin exception otherwise produces a fatal `konan::abort()` report that lacks the Kotlin stack and exception message. Calling the iOS-only `setupCrashlyticsExceptionHook` registers a handler that sends those details as a separate non-fatal report, so one crash appears twice; a shared generated ID helps locate the paired reports. The Crashlytics iOS SDK must also be added and linked separately. Static frameworks need the binary when building the app, while dynamic frameworks require it at compile time and the described CocoaPods setup generates extra cinterop definitions. The text recommends checking that reports and debug symbols reach Crashlytics to obtain symbolicated Kotlin stack traces.

## Source excerpt

Cross post from https://touchlab.co/kermit-and-crashlytics/ Kermit is a Kotlin Multiplatform logging library. The log is configured on each platform to write to various, potentially platform-specific, outputs, but can be called from shared "common" Kotlin code. Crash reporting tools like Crashlytics allow you to get error reports from remote devices running your software. These tools are very common in mobile app development, and in most cases are critical for monitoring application health in production. Crash reporting for KMP involves a setup similar to other platform-specific libraries that you want to use in a KMP context. You configure each platform according to the documentation from the software vendor, then have some common Kotlin code that can interact with the platform-specific library. Crash reporting is a bit of a special case for iOS. It's a long story, but the summary is the JVM and Kotlin throw unchecked exceptions up the stack, and if unhandled, eventually wind up in a catch-all handler. On iOS, exceptions don't work the same way. When a crash happens the runtime essentially stops and a handler is called. The crash library gathers the state of each thread's stack and sends that to the server. If you call a Kotlin function on iOS and an exception is thrown from somewhere in that Kotlin call stack, the Kotlin runtime will bubble the exception up the stack like it would on the JVM. At the "border", where you first called the Kotlin code, the Kotlin runtime will trigger a crash. If you look at the crash reports you'll see konan::abort() . That's the Kotlin runtime (internally called "konan") force-killing the process. That "works", and if you don't need symbolicated Kotlin crash info, then you're done! However, all of the crash reports will lose potentially vital info. Specifically the Kotlin stack and the exception message. To get that info, we register an uncaught exception handler with the Kotlin runtime, and when a crash originates in Kotlin code, a