PostmarkTarget Methods

Methods

CaptureContextGdc Takes snapshot of GlobalDiagnosticsContext for the LogEventInfo
(Inherited from TargetWithContext)
CaptureContextMdc Obsolete and replaced by CaptureScopeContextProperties(LogEventInfo, IDictionaryString, Object) with NLog v5. Takes snapshot of MappedDiagnosticsContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
CaptureContextMdlc Obsolete and replaced by CaptureScopeContextProperties(LogEventInfo, IDictionaryString, Object) with NLog v5. Takes snapshot of MappedDiagnosticsLogicalContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
CaptureContextNdc Obsolete and replaced by CaptureScopeContextNested(LogEventInfo) with NLog v5. Takes snapshot of NestedDiagnosticsContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
CaptureContextNdlc Obsolete and replaced by CaptureScopeContextNested(LogEventInfo) with NLog v5. Takes snapshot of NestedDiagnosticsLogicalContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
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
(Inherited from AsyncTaskTarget)
Dispose Closes the target.
(Inherited from Target)
Dispose(Boolean) Releases any managed resources
(Inherited from AsyncTaskTarget)
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Flush Flush any pending log messages (in case of asynchronous targets).
(Inherited from Target)
FlushAsync Schedules notification of when all messages has been written
(Inherited from AsyncTaskTarget)
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)
GetContextMdc Obsolete and replaced by GetScopeContextProperties(LogEventInfo) with NLog v5. Returns the captured snapshot of MappedDiagnosticsContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
GetContextMdlc Obsolete and replaced by GetScopeContextProperties(LogEventInfo) with NLog v5. Returns the captured snapshot of MappedDiagnosticsLogicalContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
GetContextNdc Obsolete and replaced by GetScopeContextNested(LogEventInfo) with NLog v5. Returns the captured snapshot of NestedDiagnosticsContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
GetContextNdlc Obsolete and replaced by GetScopeContextNested(LogEventInfo) with NLog v5. Returns the captured snapshot of NestedDiagnosticsLogicalContext for the LogEventInfo
(Inherited from TargetWithContext)
Obsolete.
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)
GetHashCodeServes as the default hash function.
(Inherited from Object)
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)
GetTypeGets the Type of the current instance.
(Inherited from Object)
InitializeTarget
(Inherited from AsyncTaskTarget)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
MergeEventProperties Merges (copies) the event context properties from any event info object stored in parameters of the given event info object.
(Inherited from Target)
Obsolete.
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)
RenderLogEvent``1(LayoutUMP, LogEventInfo, UMP) Renders the logevent into a result-value by using the provided layout
(Inherited from Target)
ResolveService``1 Resolve from DI ServiceRepository
(Inherited from Target)
RetryFailedAsyncTask Handle cleanup after failed write operation
(Inherited from AsyncTaskTarget)
SerializeItemValue Take snapshot of a single object value
(Inherited from TargetWithContext)
SerializeMdcItem Obsolete and replaced by SerializeScopeContextProperty(LogEventInfo, String, Object, Object) with NLog v5. Take snapshot of a single object value from MappedDiagnosticsContext
(Inherited from TargetWithContext)
Obsolete.
SerializeMdlcItem Obsolete and replaced by SerializeScopeContextProperty(LogEventInfo, String, Object, Object) with NLog v5. Take snapshot of a single object value from MappedDiagnosticsLogicalContext
(Inherited from TargetWithContext)
Obsolete.
SerializeNdcItem Obsolete and replaced by SerializeScopeContextNestedState(LogEventInfo, Object, Object) with NLog v5. Take snapshot of a single object value from NestedDiagnosticsContext
(Inherited from TargetWithContext)
Obsolete.
SerializeNdlcItem Obsolete and replaced by SerializeScopeContextNestedState(LogEventInfo, Object, Object) with NLog v5. Take snapshot of a single object value from NestedDiagnosticsLogicalContext
(Inherited from TargetWithContext)
Obsolete.
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
(Inherited from Target)
Write(AsyncLogEventInfo)
(Inherited from AsyncTaskTarget)
Write(IListAsyncLogEventInfo) Block for override. Instead override WriteAsyncTask(IListLogEventInfo, CancellationToken)
(Inherited from AsyncTaskTarget)
Write(LogEventInfo) Block for override. Instead override WriteAsyncTask(LogEventInfo, CancellationToken)
(Inherited from AsyncTaskTarget)
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.
(Inherited from AsyncTaskTarget)
WriteAsyncTask(LogEventInfo, CancellationToken) Override this to provide async task for writing a single logevent.

Example

Example of how to override this method, and call custom async method
C#
protected override Task WriteAsyncTask(LogEventInfo logEvent, CancellationToken token)
{
   return CustomWriteAsync(logEvent, token);
}

private async Task CustomWriteAsync(LogEventInfo logEvent, CancellationToken token)
{
    await MyLogMethodAsync(logEvent, token).ConfigureAwait(false);
}

(Overrides AsyncTaskTarget.WriteAsyncTask(LogEventInfo, CancellationToken))
WriteAsyncThreadSafe(AsyncLogEventInfo) Write to queue without locking SyncRoot
(Inherited from AsyncTaskTarget)
WriteAsyncThreadSafe(IListAsyncLogEventInfo) Block for override. Instead override WriteAsyncTask(IListLogEventInfo, CancellationToken)
(Inherited from AsyncTaskTarget)
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.
(Inherited from AsyncTaskTarget)

See Also