Class LevelMatchFilter
This is a very simple filter based on Level matching.
public class LevelMatchFilter : FilterSkeleton, IFilter, IOptionHandler
- Inheritance
-
LevelMatchFilter
- Implements
- Inherited Members
Remarks
The filter admits two options LevelToMatch and
AcceptOnMatch. If there is an exact match between the value
of the LevelToMatch option and the Level of the
LoggingEvent, then the Decide(LoggingEvent) method returns Accept in
case the AcceptOnMatch option value is set
to true, if it is false then
Deny is returned. If the Level does not match then
the result will be Neutral.
Constructors
LevelMatchFilter()
Default constructor
public LevelMatchFilter()
Properties
AcceptOnMatch
Accept when matching LevelToMatch
public bool AcceptOnMatch { get; set; }
Property Value
Remarks
The AcceptOnMatch property is a flag that determines the behavior when a matching Level is found. If the flag is set to true then the filter will Accept the logging event, otherwise it will Deny the event.
The default is true i.e. to Accept the event.
LevelToMatch
The Level that the filter will match
public Level LevelToMatch { get; set; }
Property Value
Remarks
The level that this filter will attempt to match against the LoggingEvent level. If a match is found then the result depends on the value of AcceptOnMatch.
Methods
Decide(LoggingEvent)
Tests if the Level of the logging event matches that of the filter
public override FilterDecision Decide(LoggingEvent loggingEvent)
Parameters
loggingEventLoggingEventthe event to filter
Returns
- FilterDecision
see remarks