AsyncTaskTarget Methods |
The AsyncTaskTarget type exposes the following members.
Name | Description | |
---|---|---|
CaptureContextGdc |
Takes snapshot of GlobalDiagnosticsContext for the LogEventInfo (Inherited from TargetWithContext.) | |
CaptureScopeContextNested |
Takes snapshot of nested states from ScopeContext for the LogEventInfo (Inherited from TargetWithContext.) | |
CaptureScopeContextProperties |
Takes snapshot of ScopeContext dictionary for the LogEventInfo (Inherited from TargetWithContext.) | |
CloseTarget |
Closes Target by updating CancellationToken
(Overrides TargetCloseTarget.) | |
Dispose |
Closes the target.
(Inherited from Target.) | |
Dispose(Boolean) |
Releases any managed resources
(Overrides TargetDispose(Boolean).) | |
Flush |
Flush any pending log messages (in case of asynchronous targets).
(Inherited from Target.) | |
FlushAsync |
Schedules notification of when all messages has been written
(Overrides TargetFlushAsync(AsyncContinuation).) | |
GenerateUniqueItemName |
Generates a new unique name, when duplicate names are detected
(Inherited from TargetWithContext.) | |
GetAllProperties(LogEventInfo) |
Creates combined dictionary of all configured properties for logEvent
(Inherited from TargetWithContext.) | |
GetAllProperties(LogEventInfo, IDictionaryString, Object) |
Creates combined dictionary of all configured properties for logEvent
(Inherited from TargetWithContext.) | |
GetContextProperties(LogEventInfo) |
Checks if any context properties, and if any returns them as a single dictionary
(Inherited from TargetWithContext.) | |
GetContextProperties(LogEventInfo, IDictionaryString, Object) |
Checks if any context properties, and if any returns them as a single dictionary
(Inherited from TargetWithContext.) | |
GetScopeContextNested |
Returns the captured snapshot of nested states from ScopeContext for the LogEventInfo (Inherited from TargetWithContext.) | |
GetScopeContextProperties |
Returns the captured snapshot of ScopeContext dictionary for the LogEventInfo (Inherited from TargetWithContext.) | |
InitializeTarget |
Initializes the target before writing starts
(Overrides TargetInitializeTarget.) | |
PrecalculateVolatileLayouts |
Calls the Precalculate(LogEventInfo) on each volatile layout
used by this target.
This method won't prerender if all layouts in this target are thread-agnostic.
(Inherited from Target.) | |
RenderLogEvent(Layout, LogEventInfo) |
Renders the logevent into a string-result using the provided layout
(Inherited from Target.) | |
RenderLogEventT(LayoutT, LogEventInfo, T) |
Renders the logevent into a result-value by using the provided layout
(Inherited from Target.) | |
ResolveServiceT |
Resolve from DI ServiceRepository (Inherited from Target.) | |
RetryFailedAsyncTask |
Handle cleanup after failed write operation
| |
SerializeItemValue |
Take snapshot of a single object value
(Inherited from TargetWithContext.) | |
SerializeScopeContextNestedState |
Take snapshot of a single object value from ScopeContext nested states
(Inherited from TargetWithContext.) | |
SerializeScopeContextProperty |
Take snapshot of a single object value from ScopeContext dictionary
(Inherited from TargetWithContext.) | |
ShouldIncludeProperties |
Check if logevent has properties (or context properties)
(Inherited from TargetWithContext.) | |
ToString | Returns a string that represents the current object. (Inherited from Target.) | |
Write(AsyncLogEventInfo) |
Writes async log event to the log target.
(Overrides TargetWrite(AsyncLogEventInfo).) | |
Write(IListAsyncLogEventInfo) |
Block for override. Instead override WriteAsyncTask(IListLogEventInfo, CancellationToken) (Overrides TargetWrite(IListAsyncLogEventInfo).) | |
Write(LogEventInfo) |
Block for override. Instead override WriteAsyncTask(LogEventInfo, CancellationToken) (Overrides TargetWrite(LogEventInfo).) | |
WriteAsyncLogEvent |
Writes the log to the target.
(Inherited from Target.) | |
WriteAsyncLogEvents(AsyncLogEventInfo) |
Writes the array of log events.
(Inherited from Target.) | |
WriteAsyncLogEvents(IListAsyncLogEventInfo) |
Writes the array of log events.
(Inherited from Target.) | |
WriteAsyncTask(IListLogEventInfo, CancellationToken) |
Override this to provide async task for writing a batch of logevents.
| |
WriteAsyncTask(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} | |
WriteAsyncThreadSafe(AsyncLogEventInfo) |
Write to queue without locking SyncRoot (Overrides TargetWriteAsyncThreadSafe(AsyncLogEventInfo).) | |
WriteAsyncThreadSafe(IListAsyncLogEventInfo) |
Block for override. Instead override WriteAsyncTask(IListLogEventInfo, CancellationToken) (Overrides TargetWriteAsyncThreadSafe(IListAsyncLogEventInfo).) | |
WriteFailedNotInitialized |
LogEvent is written to target, but target failed to successfully initialize
Enqueue logevent for later processing when target failed to initialize because of unresolved service dependency.
(Overrides TargetWriteFailedNotInitialized(AsyncLogEventInfo, Exception).) |