Skip to content

opensavvy.sentier.threads

Types

DelicateSpanApi

@RequiresOptIn(message = "This function is particularly easy to misuse. Ensure you have read its documentation entirely before attempting to use it.")
annotation class DelicateSpanApi

Marks low-level functions of the local task management.

Functions

currentSpan

fun currentSpan(): Span

Accesses the current Span, or throws if none were registered.

currentSpanOrNull

expect fun currentSpanOrNull(): Span?

actual fun currentSpanOrNull(): Span?

Accesses the current Span, or returns null if none were registered.

debug

inline fun debug(values: SentierValues = SentierValues.Empty, description: () -> String)

Logs an event at level LogLevel.Debug in this thread.

error

inline fun error(values: SentierValues = SentierValues.Empty, description: () -> String)

Logs an event at level LogLevel.Error in this thread.

fatal

inline fun fatal(values: SentierValues = SentierValues.Empty, description: () -> String)

Logs an event at level LogLevel.Fatal in this thread.

info

inline fun info(values: SentierValues = SentierValues.Empty, description: () -> String)

Logs an event at level LogLevel.Info in this thread.

popCurrentSpan

@DelicateSpanApi
expect fun popCurrentSpan(current: Span)

@DelicateSpanApi
actual fun popCurrentSpan(current: Span)

Pops the currentSpan, checking that it is current.

pushCurrentSpan

Pushes span as a child of the currentSpan.

task

inline fun <T> task(
    message: () -> String, 
    values: SentierValues = SentierValues.Empty, 
    crossinline block: () -> T
): T

Tracks the progress of block in a child Span.

trace

inline fun trace(values: SentierValues = SentierValues.Empty, description: () -> String)

Logs an event at level LogLevel.Trace in this thread.

useCurrentSpan

inline fun <T> useCurrentSpan(block: (Span) -> T): T

Executes block in a TaskScope instantiated from the currentSpan.

warn

inline fun warn(values: SentierValues = SentierValues.Empty, description: () -> String)

Logs an event at level LogLevel.Warning in this thread.