withContext

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

expect fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.

actual fun <T> withContext(ctx: LogContext, block: () -> T): T(source)

Executes block with ctx merged into the current context, then restores the previous context regardless of whether block throws.

The merged context is formed by overlaying ctx on top of the current context - keys present in ctx override existing keys, while keys not present in ctx are preserved from the outer context.

Return

The value returned by block.

Parameters

ctx

The context to merge into the current context for the duration of block.

block

The block of code to execute within the merged context.