Scribe
0.5.0indexedFlavored logging offering story-driven primitives: single-event notes and contextual scrolls, best-effort non-suspending variants, customizable note/scroll/entry savers, and scroll lifecycle enrichment via margins.
Flavored logging offering story-driven primitives: single-event notes and contextual scrolls, best-effort non-suspending variants, customizable note/scroll/entry savers, and scroll lifecycle enrichment via margins.
A flavored Kotlin Multiplatform logging library
Scribe is a Kotlin Multiplatform logging library built around the ideas from loggingsucks.com, so structured logs can model both single events and longer contextual flows.
note(...) and contextual logging with newScroll(...)NoteSaver, , and Add Scribe to your commonMain dependencies:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("com.rafambn:scribe:0.4.0")
}
}
}
Create a Scribe object, hire its runtime, and emit a note:
object AppScribe : Scribe() {
override val shelves: List<Saver<*>> = listOf(
NoteSaver { note ->
println("[${note.level}] ${note.tag}: ${note.message}")
}
)
}
AppScribe.hire(channel = Channel(capacity = 256))
AppScribe.note(
tag = "payments",
message = "starting checkout",
level = Urgency.INFO,
)
Use a scroll when you need shared context for a longer flow:
object BillingScribe : Scribe() {
override val shelves: List<Saver<*>> = listOf(
ScrollSaver { scroll -> println(scroll) }
)
override val imprint = mapOf(
"service" to JsonPrimitive(),
to JsonPrimitive(),
)
}
BillingScribe.hire(channel = Channel(capacity = ))
scroll = BillingScribe.newScroll(id = )
scroll[] = JsonPrimitive()
scroll[] = JsonPrimitive()
scroll[] = JsonPrimitive()
scroll.seal(BillingScribe, success = )
Each Scribe object has independent configuration and delivery lifecycle. A Scroll is a mutable JSON-element map initialized by newScroll(...); pass the runtime that should enrich and deliver it to scroll.seal(scribe, ...). Each seal(...) call emits a separate SealedScroll snapshot.
Choose the saver that matches your output flow:
val noteSaver = NoteSaver { note -> println(note) }
val scrollSaver = ScrollSaver { scroll -> println(scroll) }
val entrySaver = EntrySaver { record -> println(record) }
ScrollSaverEntrySaverMarginScribe objects for applications and imported librariesSurfaced from shared tags and platforms — no rankings paid for.