Logging
Kodio includes a lightweight, multiplatform logging facade in space.kodio.core.logging. As a library, it stays silent by default so your app controls when and where logs appear; nothing is printed to the console unless you opt in.
Enable logging
Call Kodio.configureLogging { } at application startup (for example in main(), Application.onCreate, or your Compose entry point):
platformLogWriter() is a built-in writer that routes output to the platform console:
Platform | Output |
|---|---|
Android | Logcat |
iOS / macOS | NSLog |
JVM / Desktop | stdout / stderr |
JS / Wasm | Browser console |
You can also configure logging directly via KodioLogging:
Disable logging
Logging is off by default. If you never call configureLogging, Kodio stays silent. To explicitly disable output:
Or clear writers:
Log levels
Levels are defined by the LogLevel enum. A message is emitted when its level is at or above the configured minLevel:
- Trace
Very verbose diagnostics: per-sample or per-chunk detail. Use sparingly.
- Debug
Routine internal diagnostics useful during development.
- Info
Lifecycle milestones: recording started, device selected, session released.
- Warn
Recoverable problems: fallback paths, deprecated usage, missing optional features.
- Error
Failures and caught exceptions. Prefer
error(throwable) { }to attach the cause.- None
Disables all output when set as
minLevel.
Bridge to a custom backend
Implement KodioLogWriter, a single-method functional interface, to forward Kodio logs to any backend (Kermit, SLF4J, Crashlytics, your own logger):
You can register multiple writers; each log event is forwarded to every registered writer. Use setWriters() to replace the full set, addWriter() to append, and clearWriters() to remove all.
Create loggers
Use kodioLogger(name) to obtain a tagged logger with lazy message evaluation:
Messages are evaluated only when the configured minLevel allows the event through. Check whether a level would emit with KodioLogging.isLoggable(level).
Platform coverage
The logging facade works uniformly across all Kodio targets: Android, iOS, macOS, JVM, JS, and Wasm. No platform-specific setup is required beyond calling configureLogging in your shared or platform entry point.