trace-encoder / com.squareup.tracing / TraceEncoder


class TraceEncoder :Closeable

Encodes and writes trace events to an Okio BufferedSink.


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 ClockMark to consider the beginning timestamp of the trace. All trace events’ timestamps are relative to this mark. MonoClock.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.


Name Summary
<init> TraceEncoder(scope: CoroutineScope, start:ClockMark= MonoClock.markNow(), ioDispatcher: CoroutineDispatcher = IO, sinkProvider: () -> BufferedSink)
Encodes and writes trace events to an Okio BufferedSink.


Name Summary
close fun close():Unit
createLogger fun createLogger(processName:String= "", threadName:String= ""):TraceLogger
Allocates a new thread ID named threadName and returns a TraceLogger that will log all events under that thread ID.