Introduction
Colotok is a Kotlin Multiplatform logging library.
Feature
✅ Print log with color
✅ Formatter
✅ Print log where you want
🌟 ConsoleProvider
🌟 FileProvider
🌟 StreamProvider
✅ Log Rotation
🌟 SizeBaseRotation
🌟 DateBaseRotation (duration based)
✅ Customize output location
🌟 example print log into slack
✅ Structured Logging
✅ MDC (Mapped Diagnostic Context)
✅ Metrics Collection
Integration
basic dependency
For a Kotlin Multiplatform project, add the root artifact to commonMain:
The core module, colotok-coroutines, and colotok-loki support JVM, Android, JS/Node, iosArm64, iosSimulatorArm64, and macosArm64. Apple x86 targets (iosX64 and macosX64) are not published in 0.5.0. Gradle module metadata selects the target-specific variant from the common dependency; do not add target-suffixed coordinates manually.
Plugins
Colotok provides several plugins to extend its functionality:
plugin | artifact | feature | Platform |
|---|---|---|---|
colotok-coroutines |
| coroutine support | Multi Platform |
colotok-slf4j |
| SLF4J 1.7.x bindings (JVM only) | JVM |
colotok-slf4j2 |
| SLF4J 2.x bindings (JVM only) | JVM |
colotok-cloudwatch |
| send logs to AWS CloudWatch | JVM |
colotok-loki |
| send logs to Grafana Loki | Multi Platform |
Dependencies
Structured logging requires the Kotlin serialization compiler plugin because message classes use @Serializable. The colotok artifact already exposes the serialization runtime required by its public API, so a separate runtime dependency is normally unnecessary.
Usage
Configuration
configure colotok with code.
see below.
more details config
now, you can print log into your space.