Click or drag to resize
LoggerSwallowAsyncTResult Method (FuncTaskTResult)
Runs the provided async function and returns its result. If the task does not run to completion, an exception is logged at Error level. The exception is not propagated outside of this method; a default value is returned instead.

Namespace: NLog
Assembly: NLog (in NLog.dll) Version: 4.3.0
public Task<TResult> SwallowAsync<TResult>(
	Func<Task<TResult>> asyncFunc


Type: SystemFuncTaskTResult
Async function to run.

Type Parameters

Return type of the provided function.

Return Value

Type: TaskTResult
A task that represents the completion of the supplied task. If the supplied task ends in the RanToCompletion state, the result of the new task will be the result of the supplied task; otherwise, the result of the new task will be the default value of type TResult.


See Also