Click or drag to resize

Target Class

Represents logging target.
Inheritance Hierarchy
SystemObject
  NLog.TargetsTarget
    More...

Namespace:  NLog.Targets
Assembly:  NLog (in NLog.dll) Version: 5.3.1+cf6675da40ccfd4c8c526a3b2bdbeed3442910a1
Syntax
public abstract class Target : IDisposable

The Target type exposes the following members.

Constructors
  NameDescription
Protected methodTarget
Initializes a new instance of the Target class
Top
Properties
  NameDescription
Protected propertyIsInitialized
Gets a value indicating whether the target has been initialized.
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
Public propertyName
Gets or sets the name of the target.
Protected propertySyncRoot
Gets the object which can be used to synchronize asynchronous operations that must rely on the .
Top
Methods
  NameDescription
Protected methodCloseTarget
Closes the target to release any initialized resources
Public methodDispose
Closes the target.
Protected methodDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Public methodFlush
Flush any pending log messages (in case of asynchronous targets).
Protected methodFlushAsync
Flush any pending log messages
Protected methodInitializeTarget
Initializes the target before writing starts
Public methodPrecalculateVolatileLayouts
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.
Protected methodRenderLogEvent(Layout, LogEventInfo)
Renders the logevent into a string-result using the provided layout
Protected methodRenderLogEventT(LayoutT, LogEventInfo, T)
Renders the logevent into a result-value by using the provided layout
Protected methodResolveServiceT
Resolve from DI ServiceRepository
Public methodToString
Returns a string that represents the current object.
(Overrides ObjectToString.)
Protected methodWrite(AsyncLogEventInfo)
Writes async log event to the log target.
Protected methodWrite(IListAsyncLogEventInfo)
Writes an array of logging events to the log target. By default it iterates on all events and passes them to "Write" method. Inheriting classes can use this method to optimize batch writes.
Protected methodWrite(LogEventInfo)
Writes logging event to the target destination
Public methodWriteAsyncLogEvent
Writes the log to the target.
Public methodWriteAsyncLogEvents(AsyncLogEventInfo)
Writes the array of log events.
Public methodWriteAsyncLogEvents(IListAsyncLogEventInfo)
Writes the array of log events.
Protected methodWriteAsyncThreadSafe(AsyncLogEventInfo)
Writes a log event to the log target, in a thread safe manner. Any override of this method has to provide their own synchronization mechanism. !WARNING! Custom targets should only override this method if able to provide their own synchronization mechanism. Layout-objects are not guaranteed to be thread-safe, so using them without a SyncRoot-object can be dangerous.
Protected methodWriteAsyncThreadSafe(IListAsyncLogEventInfo)
Writes an array of logging events to the log target, in a thread safe manner. Any override of this method has to provide their own synchronization mechanism. !WARNING! Custom targets should only override this method if able to provide their own synchronization mechanism. Layout-objects are not guaranteed to be thread-safe, so using them without a SyncRoot-object can be dangerous.
Protected methodWriteFailedNotInitialized
LogEvent is written to target, but target failed to successfully initialize
Top
See Also
Inheritance Hierarchy