# asyncLogging

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

Creates a new async coroutine with automatic exception logging. If an exception occurs, it will be logged using the provided logger and then rethrown when the Deferred is awaited.

#### Return

A Deferred representing the async computation

#### 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 that returns a value of type T

#### Type Parameters

T

The return type of the async computation