Package-level declarations

Types

Link copied to clipboard
data class ActiveTrace(val traceId: ByteString, val spanId: ByteString, val sampled: Boolean)

The distributed-trace context active on the current call.

Link copied to clipboard
data class CaptureConfig(val minLevel: LogLevel = LogLevel.TRACE, val untracedPolicy: UntracedPolicy = UntracedPolicy.CAPTURE, val attributeMapper: (NormalizedLogEvent) -> Map<String, String> = ::defaultAttributeMapper)

Policy for the capture core: which events to keep and how to shape their attributes.

Link copied to clipboard
data class CaptureHealth(val droppedEvents: Long = 0)

An out-of-band health signal for the log-capture edge.

Link copied to clipboard

A TraceContextProvider backed by the coroutine-context trace an app sets with withActiveTrace — the dependency-light, commonMain source for platforms with no ambient tracer (wasmJs, iOS, macOS).

Link copied to clipboard
class LogCapture(exporter: WarpLogRecordExporter, config: CaptureConfig, clock: Clock, random: Random, traceContextProvider: TraceContextProvider? = null)

The shared, platform-independent capture core.

Link copied to clipboard

A live log-capture installation — the LogCapture core plus the way to stop it.

Link copied to clipboard
enum class LogLevel : Enum<LogLevel>

A platform-independent log level, carrying its OTLP severity mapping.

Link copied to clipboard

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).

Link copied to clipboard
data class NormalizedLogEvent(val level: LogLevel, val loggerName: String, val message: String?, val attributes: Map<String, String> = emptyMap(), val emittedEpochNanos: Long? = null)

A log event normalized to a platform-independent shape.

Link copied to clipboard
sealed class ResolvedLogEvent

An opaque snapshot of a log event ready for queued capture.

Link copied to clipboard
fun interface TraceContextProvider

Supplies the trace context active on the current call, or null when none.

Link copied to clipboard

What to do with a log emitted outside any active trace.

Properties

Link copied to clipboard
const val CAPTURE_BATCH_MAX: Int = 256

The most events one drain turn hands to the exporter at once.

Link copied to clipboard
const val CAPTURE_QUEUE_CAPACITY: Int = 1024

How deep the capture queue is — the buffer between the application's synchronous logging call and the drain coroutine that exports each event.

Link copied to clipboard

Attribute key under which a capture edge may record an exception's message.

Link copied to clipboard

Attribute key under which defaultAttributeMapper records the logger name.

Functions

Link copied to clipboard

The default CaptureConfig.attributeMapper: records the logger name under LOGGER_NAME_ATTRIBUTE, then the event's own attributes (which therefore win on key collision).

Link copied to clipboard
fun installLogCapture(exporter: WarpLogRecordExporter, config: CaptureConfig, clock: Clock, random: Random, scope: CoroutineScope, traceContextProvider: TraceContextProvider? = null): LogCaptureInstallation

Install log capture — the single uniform entry point on every platform.

Link copied to clipboard
expect suspend fun <T> withActiveTrace(trace: ActiveTrace, block: suspend CoroutineScope.() -> T): T

Run block with trace as the active trace for the log lines it emits, then restore the previously-active trace. The whole point of native trace context: whoever starts a span wraps the work, and kuilt's sampling gate then stamps or drops those lines by that trace — on wasmJs, iOS and macOS, not only the JVM.

Link copied to clipboard
expect suspend fun <T> withLogContext(attributes: Map<String, String>, block: suspend CoroutineScope.() -> T): T

Run block with attributes bound to the current scope, so every log line it emits is stamped with them, then restore the previously-bound context.

suspend fun <T> withLogContext(vararg attributes: Pair<String, String>, block: suspend CoroutineScope.() -> T): T

withLogContext taking the attributes as pairs — withLogContext("session.id" to id) { … }.