launchLogging

fun CoroutineScope.launchLogging(errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit): Job(source)

Launches a new coroutine with automatic exception logging. If an exception occurs, it will be logged using the provided logger and then rethrown.

Return

A Job representing the launched coroutine

Parameters

errorMessageBuilder

A function to build the error message from the caught exception. Defaults to "Something web wrong"

logger

The logger instance to use for logging exceptions. Defaults to KSLog

context

Additional CoroutineContext for the new coroutine. Defaults to EmptyCoroutineContext

start

The coroutine start option. Defaults to CoroutineStart.DEFAULT

block

The suspending function to execute in the new coroutine