TraceEncoder
class TraceEncoder(scope: CoroutineScope, start: TimeMark = TraceEncoderTimeMark, ioDispatcher: CoroutineDispatcher = IO, sinkProvider: () -> BufferedSink) : Closeable(source)
Encodes and writes trace events to an Okio BufferedSink.
Parameters
scope
The CoroutineScope that defines the lifetime for the encoder. When the scope is cancelled or fails, the sink returned from sinkProvider will be closed.
start
The TimeMark to consider the beginning timestamp of the trace. All trace events' timestamps are relative to this mark. TimeSource.Monotonic.markNow by default.
ioDispatcher
The CoroutineDispatcher to use to execute all IO operations. IO by default.
sinkProvider
Returns the BufferedSink to use to write trace events to. Called on a background thread.
Constructors
Link copied to clipboard
constructor(scope: CoroutineScope, start: TimeMark = TraceEncoderTimeMark, ioDispatcher: CoroutineDispatcher = IO, sinkProvider: () -> BufferedSink)
Functions
Link copied to clipboard
Allocates a new thread ID named threadName and returns a TraceLogger that will log all events under that thread ID.