SharedLogFlow

interface SharedLogFlow<C : Log.Category> : SharedFlow<Log.Event<C>> , Log.Sink<C>

A shared flow of log events, which can be assigned as a Sink.

It will emit Events into the flow when log is called.

Example

class Manager {
enum class Component : Log.Category {
A, B, C
}
var logger: Log.Sink<Component>? = Log.Sink.Null
}

val m = Manager()
m.logger = Log.Sink.Flow().also { flow ->
flow
.onEach { db.save(it) }
.launchIn(scope)
}

Properties

Link copied to clipboard
abstract val replayCache: List<Log.Event<C>>

Functions

Link copied to clipboard
abstract suspend override fun collect(collector: FlowCollector<Log.Event<C>>): Nothing
Link copied to clipboard
abstract fun log(category: C, level: Log.Level, source: String?, throwable: Throwable?, message: () -> String)

Log a message with the given category and level.