CompositeSink

Fans every event out to several sinks. Enabled for a level when any sink is. Each sink is called in isolation: an Exception from one does not stop the others (VM errors propagate). Only sinks enabled for the event's level receive it.

Example:

val sink = CompositeSink(RingBufferSink(256), LoggingSink(log = ::println))

The list is copied at construction, so later changes to it have no effect. Events are delivered to the sinks in list order on the emitting thread.

Requires opting in to ExperimentalStructuredCoroutines.

Parameters

sinks

the sinks to fan out to.

Constructors

Link copied to clipboard
constructor(sinks: List<TraceSink>)

Functions

Link copied to clipboard
open override fun emit(event: TraceEvent)

Receives one event. See the contract in the type documentation.

Link copied to clipboard
open override fun isEnabled(level: TraceLevel): Boolean

Whether this sink wants events of level. Defaults to true for every level.