Class ThrottleTargetWrapper
An optional wrapper target that aggregates similar consecutive log messages, which can be
useful when enabling Debug or Trace logging with high volume data.
The aggregation only applies to messages that have the same:
Log level, Locator, Category, ThreadId (if present), and Message.
To use this, add a wrapper target of type "ThrottleTargetWrapper" to the NLog configuration.
Inheritance
Implements
Inherited Members
Namespace: actionETL.Logging.NLogExternal
Assembly: actionETL.dll
Syntax
[Target("ThrottleTargetWrapper", IsWrapper = true)]
public class ThrottleTargetWrapper : WrapperTargetBase, IDisposable
Constructors
ThrottleTargetWrapper()
Initializes a new instance of the ThrottleTargetWrapper class.
Not used directly by the library user.
Declaration
public ThrottleTargetWrapper()
ThrottleTargetWrapper(Target)
Initializes a new instance of the ThrottleTargetWrapper class.
Not used directly by the library user.
Declaration
public ThrottleTargetWrapper(Target target)
Parameters
| Type | Name | Description |
|---|---|---|
| NLog.Targets.Target | target | The target. |
Properties
MaxThrottled
Gets or sets the maximum throttled messages before outputting them.
Not used directly by the library user.
Declaration
public int MaxThrottled { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 | Maximum number of aggregated messages before outputting them. |
MinDuplicates
Gets or sets the minimum duplicates before throttling occurs.
Not used directly by the library user.
Declaration
public int MinDuplicates { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 | The minimum duplicates. |
TimeoutSeconds
Gets or sets the maximum time before outputting currently aggregated messages.
Not used directly by the library user.
Declaration
public double TimeoutSeconds { get; set; }
Property Value
| Type | Description |
|---|---|
| Double | The timeout seconds. |
Methods
CloseTarget()
Closes the target and releases any unmanaged resources.
Not used directly by the library user.
Declaration
protected override void CloseTarget()
Overrides
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Unexpected log events in CloseTarget(). |
FlushAsync(AsyncContinuation)
Flushes pending events (if any).
Not used directly by the library user.
Declaration
protected override void FlushAsync(AsyncContinuation asyncContinuation)
Parameters
| Type | Name | Description |
|---|---|---|
| NLog.Common.AsyncContinuation | asyncContinuation | The asynchronous continuation. |
Overrides
InitializeTarget()
Initializes the target. Can be used by inheriting classes to initialize logging.
Not used directly by the library user.
Declaration
protected override void InitializeTarget()
Overrides
Write(AsyncLogEventInfo)
Writes the specified asynchronous log event information.
Not used directly by the library user.
Declaration
protected override void Write(AsyncLogEventInfo logEvent)
Parameters
| Type | Name | Description |
|---|---|---|
| NLog.Common.AsyncLogEventInfo | logEvent | The asynchronous log event information. |