Skip to content
Skills Library
Programming · Building & coding

kmp-logging

/kmp-logging

Multiplatform logging in Kotlin Multiplatform with Kermit (co.touchlab:kermit:2.0.7). Use when adding logging to shared code - the global Logger, severity levels (v/d/i/w/e/a), Logger.withTag for per-class tags, configuring LogWriters and minSeverity, building a custom Logger with StaticConfig, and routing warnings/errors to Crashlytics or Bugsnag. Kermit writes to Logcat on Android and OSLog on iOS automatically; Napier is a lighter alternative. For Android-only Logcat/ADB/ANR debugging use android-skills:android-debugging; for analytics events (not logs) use analytics-patterns.

Licence
MIT
Last repository change
25.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Multiplatform logging in Kotlin Multiplatform with Kermit (co.touchlab:kermit:2.0.7). Use when adding logging to shared code - the global Logger, severity levels (v/d/i/w/e/a), Logger.withTag for per-class tags, configuring LogWriters and minSeverity, building a custom Logger with StaticConfig, and routing warnings/errors to Crashlytics or Bugsnag. Kermit writes to Logcat on Android and OSLog on iOS automatically; Napier is a lighter alternative. For Android-only Logcat/ADB/ANR debugging use android-skills:android-debugging; for analytics events (not logs) use analytics-patterns.

Original author description

Multiplatform logging in Kotlin Multiplatform with Kermit (co.touchlab:kermit:2.0.7). Use when adding logging to shared code - the global Logger, severity levels (v/d/i/w/e/a), Logger.withTag for per-class tags, configuring LogWriters and minSeverity, building a custom Logger with StaticConfig, and routing warnings/errors to Crashlytics or Bugsnag. Kermit writes to Logcat on Android and OSLog on iOS automatically; Napier is a lighter alternative. For Android-only Logcat/ADB/ANR debugging use android-skills:android-debugging; for analytics events (not logs) use analytics-patterns.

How it works

  1. Overview
  2. When to use
  3. Dependency
  4. Usage
  5. Configure writers + severity (once, at startup)
  6. Common mistakes
  7. See also
Original SKILL.md headings · 69 lines, 283 words
SKILL.md preview
---
name: kmp-logging
description: Multiplatform logging in Kotlin Multiplatform with Kermit (co.touchlab:kermit:2.0.7). Use when adding logging to shared code - the global Logger, severity levels (v/d/i/w/e/a), Logger.withTag for per-class tags, configuring LogWriters and minSeverity, building a custom Logger with StaticConfig, and routing warnings/errors to Crashlytics or Bugsnag. Kermit writes to Logcat on Android and OSLog on iOS automatically; Napier is a lighter alternative. For Android-only Logcat/ADB/ANR debugging use android-skills:android-debugging; for analytics events (not logs) use analytics-patterns.
---

# KMP Logging (Kermit)

## Overview

**Kermit** (Touchlab) is the standard KMP logging library — log from `commonMain` and it writes to **Logcat** on Android and **OSLog** on iOS automatically (console on JS). Current version **2.0.7**. Logs flow through composable `LogWriter`s, so you can also send them to Crashlytics/Bugsnag.

## When to use

- Logging from shared code (`commonMain`)
- Tagged loggers per class/feature
- Sending warnings/errors to crash reporting
- Controlling verbosity per build (`minSeverity`)

## Dependency

```kotlin
commonMain.dependencies {
    implementation("co.touchlab:kermit:2.0.7")
    // implementation("co.touchlab:kermit-crashlytics:2.0.7") // optional
}
```

## Usage

```kotlin
// Global logger — lambda message is only built if it will actually be logged
Logger.i { "App started" }
Logger.e(throwable) { "Failed to load user $id" }

// Tagged logger per class
class UserRepository {
    private val log = Logger.withTag("UserRepository")
    fun load() { log.d { "loading…" } }
}
```

Severities, low → high: `v` `d` `i` `w` `e` `a`.

## Configure writers + severity (once, at startup)

```kotlin
Logger.setMinSeverity(if (isDebug) Severity.Verbose else Severity.Warn)
Logger.setLogWriters(platformLogWriter(), CrashlyticsLogWriter())

// or a fully custom instance:
val log = Logger(
    config = StaticConfig(
        minSeverity = Severity.Info,
        logWriterList = listOf(platformLogWriter()),
    ),
    tag = "MyApp",
)
```

## Common mistakes

| Mistake | Fix |
|---|---|
| String concatenation in hot log paths | Use the lambda form `{ "x=$x" }` — skipped below `minSeverity` |
| Same verbosity in release | Raise `minSeverity` for release builds |
| Expecting iOS logs in Logcat | iOS writes to **OSLog** (Console.app / Xcode), not Logcat |
| Crash logs not appearing | Add `CrashlyticsLogWriter` to the writer list |

## See also

- Android Logcat / ADB / ANR debugging: `android-skills:android-debugging`
- Analytics events (distinct from logs): `analytics-patterns`

Versions

The database has no other skills named kmp-logging.

Database snapshot: 13.11.2026 · package version 2f3ea6a653d4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90mobile-kotlin-multiplatform
    Use this skill when the user says 'Kotlin Multiplatform', 'KMP', 'Compose Multiplatform', 'shared Kotlin', 'KMP module', 'expect/actual', 'commonMain', 'KMP project', 'multiplatform library'. Build cross-platform mobile apps with Kotlin Multiplatform sharing business logic,…
  • 100android-debugging
    Use when debugging Android or KMP issues — Android-specific techniques covering Logcat, ADB, ANR traces, R8 stack trace decoding, memory leaks, Gradle build failures, and Compose recomposition bugs, on a root-cause-first foundation.
  • 100android-clean-architecture
    Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.
  • 90mobile-kmp
    Works on Kotlin Multiplatform mobile projects with shared Kotlin source sets and Android/iOS targets. Use for architecture, tests, debugging, reviews, performance, security, accessibility, dependencies and releases when `org.jetbrains.kotlin.multiplatform` is applied; inspect…
  • 100kotlin-tooling-agp9-migration
    Migrates Kotlin Multiplatform (KMP) projects to Android Gradle Plugin 9.0+. Handles plugin replacement (com.android.kotlin.multiplatform.library), module splitting, DSL migration, and the new default project structure. Use when upgrading AGP, when build fails due to KMP+AGP…
  • 100kotlin-multiplatform
    Kotlin Multiplatform (KMP) is JetBrains' technology for sharing Kotlin code between Android, iOS, web, and desktop applications while keeping the UI native on each platform. Use when a user asks to set up a KMP shared module, share business logic, networking or a data layer…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.