Click or drag to resize

AsyncTaskTargetWriteAsyncTask Method (LogEventInfo, CancellationToken)

Override this to provide async task for writing a single logevent.
Examples
Example of how to override this method, and call custom async method
1protected override Task WriteAsyncTask(LogEventInfo logEvent, CancellationToken token)
2{
3   return CustomWriteAsync(logEvent, token);
4}
5
6private async Task CustomWriteAsync(LogEventInfo logEvent, CancellationToken token)
7{
8    await MyLogMethodAsync(logEvent, token).ConfigureAwait(false);
9}

Namespace:  NLog.Targets
Assembly:  NLog (in NLog.dll) Version: 5.3.4+73d83d3161d31288ca5c554cc50d27b6bed5f28b
Syntax
protected abstract Task WriteAsyncTask(
	LogEventInfo logEvent,
	CancellationToken cancellationToken
)

Parameters

logEvent
Type: NLogLogEventInfo
The log event.
cancellationToken
Type: System.ThreadingCancellationToken
The cancellation token

Return Value

Type: Task
See Also