MutableTraceContextHolder

A directly-settable TraceContextProvider — the escape hatch for apps or tests that cannot scope their tracing as coroutines (prefer withActiveTrace + CoroutineContextTraceProvider, which is the primary API).

The current trace is a single process-global value, guarded by an atomic ref. It has no execution locality: on a multi-threaded runtime a concurrent logger on another thread sees whatever was set last, so use this only where a single logical trace is active at a time (e.g. a single-threaded wasmJs app, or a test).

Constructors

Link copied to clipboard
constructor(initial: ActiveTrace? = null)

Functions

Link copied to clipboard
open override fun current(): ActiveTrace?

The ActiveTrace active on the current call, or null if untraced.

Link copied to clipboard
fun set(trace: ActiveTrace?)

Set the current trace (or null to clear it).