kotlin-logging
llms.txt3.1k starsChanged 10 days agoApache-2.0View on GitHub
Lightweight, idiomatic, lazy-evaluated logging facade for Kotlin Multiplatform (io.github.oshai:kotlin-logging). Wraps SLF4J (with optional direct Logback / JUL backends) on JVM, SLF4J or native android.util.Log on Android, Apple Unified Logging (os_log) on macOS/iOS/watchOS/tvOS, and configurable console/direct logging across JS, WebAssembly (wasmJs, wasmWasi), Linux, Windows, and Android Native. Set System.setProperty("kotlin-logging-to-android-native", "true") once before first logger initialization to route logs directly to android.util.Log without SLF4J. On SLF4J 2.0 and direct Logback backends, payload entries are forwarded as structured key-value pairs.
Trending
More talk lately.about the whole repository
Who's talking about oshai/kotlin-logging
- nmouman/PyTestGuard“Bump io.github.oshai:kotlin-logging-jvm from 7.0.3 to 7.0.6”GitHub · Apr 14, 2025 · 2 reactions
- Ahoo-Wang/CoSky“fix(deps) Update io.github.oshai:kotlin-logging-jvm to v8.0.4”GitHub · Jul 8, 2026 · 1 reactions
- Ahoo-Wang/CoApi“fix(deps) Update io.github.oshai:kotlin-logging-jvm to v8.0.4”GitHub · Jun 19, 2026 · 1 reactions
- Ahoo-Wang/wow-project-template“fix(deps) Update io.github.oshai:kotlin-logging-jvm to v8.0.4”GitHub · Jun 19, 2026 · 1 reactions
- Ahoo-Wang/Simba“fix(deps) Update kotlin.logging to v8.0.4”GitHub · Jun 18, 2026 · 1 reactions
The biggest 5 of 50 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 50
Talked about on GitHub (50 times).
On GitHub · 50
- Apr 14, 2025Bump io.github.oshai:kotlin-logging-jvm from 7.0.3 to 7.0.6 — nmouman/PyTestGuard2 reactions · 2 comments
- Jul 8, 2026fix(deps) Update io.github.oshai:kotlin-logging-jvm to v8.0.4 — Ahoo-Wang/CoSky1 reaction · 1 comment
- Jun 19, 2026fix(deps) Update io.github.oshai:kotlin-logging-jvm to v8.0.4 — Ahoo-Wang/CoApi1 reaction · 3 comments
- Jun 19, 2026fix(deps) Update io.github.oshai:kotlin-logging-jvm to v8.0.4 — Ahoo-Wang/wow-project-template1 reaction · 1 comment
- Jun 18, 2026fix(deps) Update kotlin.logging to v8.0.4 — Ahoo-Wang/Simba1 reaction · 1 comment
45 more on GitHub
- Jan 1, 2026Update dependency io.github.oshai:kotlin-logging to v7.0.14 — Mimis-Gildi/riddle-me-this1 reaction · 1 comment
- Jan 1, 2026Update dependency io.github.oshai:kotlin-logging to v7.0.14 — Mimis-Gildi/riddle-me-this1 reaction · 1 comment
- Oct 29, 2025Refactoring to Multiplatform Protocol with KMP — phodal/auto-dev1 reaction
- Oct 24, 2025Bump the gradle-version-updates group across 1 directory with 24 updates — communitiesuk/eip-ero-print-api1 reaction · 1 comment
- Aug 19, 2025deps(deps): bump the monitoring group with 3 updates — JetBrains/koog1 reaction · 5 comments
- Aug 19, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.13 — Mimis-Gildi/riddle-me-this1 reaction
- Aug 19, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.13 — Mimis-Gildi/riddle-me-this1 reaction
- Aug 19, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.14 — daksh7011/troy1 reaction · 2 comments
- Aug 19, 2025Update Gradle Root Updates — Gervi-Hera-Vitr/sindri-labs1 reaction
- Aug 7, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.12 — Mimis-Gildi/riddle-me-this1 reaction · 1 comment
- Aug 7, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.12 — Mimis-Gildi/riddle-me-this1 reaction · 1 comment
- Aug 6, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.12 — Gervi-Hera-Vitr/sindri-labs1 reaction · 1 comment
- Aug 4, 2025⬆️ gradle (buildSrc): Bump io.github.oshai:kotlin-logging from 7.0.7 to 7.0.11 in /buildSrc — Mimis-Gildi/riddle-me-this1 reaction · 1 comment
- Aug 4, 2025⬆️ gradle: Bump io.github.oshai:kotlin-logging from 7.0.7 to 7.0.11 — Mimis-Gildi/riddle-me-this1 reaction
- Aug 3, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.11 — Gervi-Hera-Vitr/sindri-labs1 reaction · 1 comment
- Aug 1, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.13 — daksh7011/Links-Detektor1 reaction · 1 comment
- Aug 1, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.12 — daksh7011/troy1 reaction · 1 comment
- Aug 1, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.10 — Gervi-Hera-Vitr/sindri-labs1 reaction · 1 comment
- Jul 31, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.14 — daksh7011/qbt-bot1 reaction · 1 comment
- Mar 6, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.7 — daksh7011/qbt-bot1 reaction · 2 comments
- Mar 6, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.7 - autoclosed — daksh7011/troy1 reaction · 3 comments
- Feb 6, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.4 — daksh7011/troy1 reaction · 2 comments
- Feb 6, 2025Update dependency io.github.oshai:kotlin-logging to v7.0.4 — daksh7011/qbt-bot1 reaction · 2 comments
- Feb 4, 2025Add KotlinLogging to replace the LoggerFactory with a more ideomatic approach — boudicca-events/boudicca.events1 reaction
- Dec 7, 2024Update dependency io.github.oshai:kotlin-logging to v7.0.3 - autoclosed — daksh7011/troy1 reaction · 2 comments
- Nov 28, 2024Update dependency io.github.oshai:kotlin-logging to v7.0.3 — Gervi-Hera-Vitr/sindri-labs1 reaction · 1 comment
- Jan 15, 2024Update dependency io.github.oshai:kotlin-logging-jvm to v6.0.3 — salesforce-misc/ReVoman1 reaction · 1 comment
- Jan 11, 2024Update dependency io.github.oshai:kotlin-logging-jvm to v6.0.2 — salesforce-misc/ReVoman1 reaction · 1 comment
- Nov 10, 2026build(deps): bump io.github.oshai:kotlin-logging-jvm from 8.0.4 to 8.0.6 — easimon/shelly-exporter0 reactions
- Nov 9, 2026Bump io.github.oshai:kotlin-logging-jvm from 8.0.4 to 8.0.6 — navikt/ufore-dokument-mottak0 reactions
- Nov 9, 2026Bump io.github.oshai:kotlin-logging from 8.0.4 to 8.0.6 — vooft/kotlin-kafka-client0 reactions
- Nov 9, 2026Bump io.github.oshai:kotlin-logging-jvm from 8.0.4 to 8.0.6 — jenspapenhagen/stardate0 reactions
- Nov 9, 2026build(deps): bump io.github.oshai:kotlin-logging-jvm from 8.0.4 to 8.0.6 — flags-gg/flags-kotlin0 reactions
- Nov 9, 2026build(deps): bump io.github.oshai:kotlin-logging from 7.0.13 to 8.0.6 — modelix/modelix.mps-plugins0 reactions
- Nov 9, 2026Bump io.github.oshai:kotlin-logging from 8.0.4 to 8.0.6 — attocash/signer0 reactions
- Nov 9, 2026chore(deps): bump io.github.oshai:kotlin-logging-jvm from 8.0.4 to 8.0.6 in /platform — coreyh-nz/linkr0 reactions
- Nov 2, 2026[apk-xref:findings] gpt-mobile: cross-reference findings — timerloggedout-spec/termux-monorepo0 reactions · 2 comments
- May 4, 2026Update Logging Updates — Mimis-Gildi/mcp-total-recall0 reactions · 4 comments
- May 3, 2026Update dependency io.github.oshai:kotlin-logging to v8.0.02 — Gervi-Hera-Vitr/sindri-labs0 reactions · 2 comments
- Feb 16, 2026Update dependency io.github.oshai:kotlin-logging to v8 — Mimis-Gildi/riddle-me-this0 reactions · 1 comment
- Feb 16, 2026Update dependency io.github.oshai:kotlin-logging to v8 — Mimis-Gildi/riddle-me-this0 reactions · 1 comment
- Feb 16, 2026Update dependency io.github.oshai:kotlin-logging to v8 — daksh7011/troy0 reactions · 1 comment
- Feb 16, 2026Update dependency io.github.oshai:kotlin-logging to v8 — Gervi-Hera-Vitr/sindri-labs0 reactions · 1 comment
- Dec 19, 2025[Deprecation Check] 2 deprecation warning(s) detected — shining-cat/SimpleHIIT0 reactions
- Sep 1, 2025Add support for Wasm/Wasi to krpc — Kotlin/kotlinx-rpc0 reactions · 1 comment
In this repositoryOne other file it gives its agents.
The file
We split this llms.txt into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 7
Canonical coordinates & package (
5.0.0+/8.x): Always use Maven group ID io.github.oshai and package io.github.oshai.kotlinlogging. - Very specific: line 8
Lazy
{}lambdas or fluent builders only (8.0.0+): All non-lambda String? overloads on KLogger (including logger.info("msg"), …
≈ “Common” is an estimate: at least 1 in 5 of the 3,727 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# kotlin-logging
> Lightweight, idiomatic, lazy-evaluated logging facade for Kotlin Multiplatform (`io.github.oshai:kotlin-logging`). Wraps SLF4J (with optional direct Logback / JUL backends) on JVM, SLF4J or native `android.util.Log` on Android, Apple Unified Logging (`os_log`) on macOS/iOS/watchOS/tvOS, and configurable console/direct logging across JS, WebAssembly (`wasmJs`, `wasmWasi`), Linux, Windows, and Android Native.
## Critical Rules for Code Generation
- **Canonical coordinates & package (`5.0.0+` / `8.x`)**: Always use Maven group ID `io.github.oshai` and package `io.github.oshai.kotlinlogging`. **Never** use the legacy `3.x` group ID `io.github.microutils` or `import mu.*` (`mu.KotlinLogging`, `mu.KLogger`, `mu.withLoggingContext`).
- **Lazy `{}` lambdas or fluent builders only (`8.0.0+`)**: All non-lambda `String?` overloads on `KLogger` (including `logger.info("msg")`, `logger.error("msg", ex)`, and `logger.info("msg {}", arg)`) were removed in `8.0.0`. Every log call in `8.x` must use a trailing `{}` lambda (`logger.info { "msg" }`, `logger.error(ex) { "msg" }`) or a fluent builder (`logger.atInfo { ... }`).
- **Explicit SLF4J runtime on JVM**: `kotlin-logging-jvm` declares `org.slf4j:slf4j-api` as `compileOnly` so applications can choose SLF4J `2.x` or `1.7.x`. Always add an SLF4J backend (such as `ch.qos.logback:logback-classic` or `org.slf4j:slf4j-simple:2.0.20`) in JVM applications.
- **Avoid deprecated APIs**: Declare a file-level `private val logger = KotlinLogging.logger {}` instead of inheriting from deprecated `KLogging()` / `KLoggable`, and do not pass the deprecated `restorePrevious` parameter to `withLoggingContextAsync`.
## Dependencies (`8.0.7`)
### Gradle (Kotlin DSL — JVM)
```kotlin
dependencies {
implementation("io.github.oshai:kotlin-logging-jvm:8.0.7")
runtimeOnly("org.slf4j:slf4j-simple:2.0.20") // or ch.qos.logback:logback-classic
}
```
### Kotlin Multiplatform (`commonMain`)
```kotlin
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.oshai:kotlin-logging:8.0.7")
}
}
}
```
### Android
```kotlin
dependencies {
implementation("io.github.oshai:kotlin-logging-android:8.0.7")
}
```
Set `System.setProperty("kotlin-logging-to-android-native", "true")` once before first logger initialization to route logs directly to `android.util.Log` without SLF4J.
### Coroutines MDC (`jvmMain`)
```kotlin
dependencies {
implementation("io.github.oshai:kotlin-logging-jvm:8.0.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:1.10.2")
}
```
## Idiomatic `8.x` Usage
### Obtaining a Logger & Lazy Logging
```kotlin
import io.github.oshai.kotlinlogging.KotlinLogging
private val logger = KotlinLogging.logger {}
class OrderService {
fun process(orderId: String) {
logger.debug { "Starting order $orderId" }
try {
logger.info { "Completed order $orderId" }
} catch (e: Exception) {
// Throwable is always the FIRST argument; message lambda is LAST
logger.error(e) { "Failed processing order $orderId" }
throw e
}
}
}
```
- On JVM/Android, `KotlinLogging.logger {}` inside nested or inner classes resolves to the enclosing top-level class name; pass `KotlinLogging.logger(Outer.Inner::class.java.name)` when a distinct nested logger name is needed.
- On Kotlin/JS, `private val logger by KotlinLogging.logger()` is also available inside classes.
### Fluent Structured Logging (`atTrace` / `atDebug` / `atInfo` / `atWarn` / `atError`)
```kotlin
logger.atInfo {
message = "Order processed"
cause = optionalException
payload = mapOf(
"orderId" to orderId,
"items" to itemCount,
)
}
```
On SLF4J 2.0 and direct Logback backends, `payload` entries are forwarded as structured key-value pairs.
### Synchronous MDC (`withLoggingContext` — JVM)
```kotlin
import io.github.oshai.kotlinlogging.withLoggingContext
withLoggingContext("requestId" to requestId, "userId" to userId) {
logger.info { "Handling request" }
}
```
### Coroutines MDC (`withLoggingContextAsync` — JVM + `kotlinx-coroutines-slf4j`)
```kotlin
import io.github.oshai.kotlinlogging.coroutines.withLoggingContextAsync
suspend fun handleRequest(requestId: String) {
withLoggingContextAsync("requestId" to requestId) {
logger.info { "MDC preserved across suspension points" }
}
}
```
### Multiplatform Direct Logger Configuration (JS, Wasm, Native)
```kotlin
import io.github.oshai.kotlinlogging.KotlinLoggingConfiguration
import io.github.oshai.kotlinlogging.Level
KotlinLoggingConfiguration.direct.logLevel = Level.DEBUG
```
## Documentation
- [API Reference (Dokka)](https://oshai.github.io/kotlin-logging/): Multiplatform KDoc API documentation for `commonMain`, `jvmMain`, `androidMain`, `darwinMain`, `jsMain`, `wasmJsMain`, `wasmWasiMain`, and `nativeMain`.
- [README](https://github.com/oshai/kotlin-logging/blob/master/README.md): Project overview, installation snippets, multiplatform target list, and FAQ.
- [OpenRewrite Migration Guide](https://github.com/oshai/kotlin-logging/blob/master/docs/openrewrite/README.md): Automated migration recipe (`io.github.oshai.kotlinlogging.UpgradeToKotlinLogging8`) for upgrading from `io.github.microutils` (`mu.*`) to `io.github.oshai` `8.x`.
- [OpenRewrite Recipe YAML](https://github.com/oshai/kotlin-logging/blob/master/docs/openrewrite/rewrite.yml): Declarative OpenRewrite recipe definition.
- [Multiplatform Support Wiki](https://github.com/oshai/kotlin-logging/wiki/Multiplatform-support): Platform-specific configuration for JVM, Android, JS, WebAssembly, Apple (`os_log`), Linux, and Windows.
- [Changelog & Major Versions](https://github.com/oshai/kotlin-logging/blob/master/ChangeLog.md): Summary of breaking changes across versions `1.x` through `8.x`.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

