C# Class NLog.Targets.Wrappers.LimitingTargetWrapper

Inheritance: NLog.Targets.Wrappers.WrapperTargetBase
Mostrar archivo Open project: NLog/NLog Class Usage Examples

Private Properties

Property Type Description
IsIntervalExpired bool
ResetInterval void

Public Methods

Method Description
LimitingTargetWrapper ( ) : System

Initializes a new instance of the LimitingTargetWrapper class.

LimitingTargetWrapper ( Target wrappedTarget ) : System

Initializes a new instance of the LimitingTargetWrapper class.

LimitingTargetWrapper ( Target wrappedTarget, int messageLimit, System.TimeSpan interval ) : System

Initializes a new instance of the LimitingTargetWrapper class.

LimitingTargetWrapper ( string name, Target wrappedTarget ) : System

Initializes a new instance of the LimitingTargetWrapper class.

Protected Methods

Method Description
InitializeTarget ( ) : void

Initializes the target and resets the current Interval and MessagesWrittenCount.

Write ( NLog.Common.AsyncLogEventInfo logEvent ) : void

Writes log event to the wrapped target if the current MessagesWrittenCount is lower than MessageLimit. If the MessageLimit is already reached, no log event will be written to the wrapped target. MessagesWrittenCount resets when the current Interval is expired.

Private Methods

Method Description
IsIntervalExpired ( ) : bool
ResetInterval ( ) : void

Method Details

InitializeTarget() protected method

Initializes the target and resets the current Interval and MessagesWrittenCount.
protected InitializeTarget ( ) : void
return void

LimitingTargetWrapper() public method

Initializes a new instance of the LimitingTargetWrapper class.
public LimitingTargetWrapper ( ) : System
return System

LimitingTargetWrapper() public method

Initializes a new instance of the LimitingTargetWrapper class.
public LimitingTargetWrapper ( Target wrappedTarget ) : System
wrappedTarget Target The wrapped target.
return System

LimitingTargetWrapper() public method

Initializes a new instance of the LimitingTargetWrapper class.
public LimitingTargetWrapper ( Target wrappedTarget, int messageLimit, System.TimeSpan interval ) : System
wrappedTarget Target The wrapped target.
messageLimit int Maximum number of messages written per interval.
interval System.TimeSpan Interval in which the maximum number of messages can be written.
return System

LimitingTargetWrapper() public method

Initializes a new instance of the LimitingTargetWrapper class.
public LimitingTargetWrapper ( string name, Target wrappedTarget ) : System
name string The name of the target.
wrappedTarget Target The wrapped target.
return System

Write() protected method

Writes log event to the wrapped target if the current MessagesWrittenCount is lower than MessageLimit. If the MessageLimit is already reached, no log event will be written to the wrapped target. MessagesWrittenCount resets when the current Interval is expired.
protected Write ( NLog.Common.AsyncLogEventInfo logEvent ) : void
logEvent NLog.Common.AsyncLogEventInfo Log event to be written out.
return void