Class LoggerMatchFilter
Simple filter to match a string in the event's logger name.
public class LoggerMatchFilter : FilterSkeleton, IFilter, IOptionHandler
- Inheritance
-
LoggerMatchFilter
- Implements
- Inherited Members
Remarks
The works very similar to the LevelMatchFilter. It admits two
options LoggerToMatch and AcceptOnMatch. If the
LoggerName of the LoggingEvent starts
with the value of the LoggerToMatch option, 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.
Constructors
LoggerMatchFilter()
Default constructor
public LoggerMatchFilter()
Properties
AcceptOnMatch
Accept when matching LoggerToMatch
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.
LoggerToMatch
The LoggerName that the filter will match
public string LoggerToMatch { get; set; }
Property Value
Remarks
This filter will attempt to match this value against logger name in the following way. The match will be done against the beginning of the logger name (using String.StartsWith(string)). The match is case sensitive. If a match is found then the result depends on the value of AcceptOnMatch.
Methods
Decide(LoggingEvent)
Check if this filter should allow the event to be logged
public override FilterDecision Decide(LoggingEvent loggingEvent)
Parameters
loggingEventLoggingEventthe event being logged
Returns
- FilterDecision
see remarks
Remarks
The rendered message is matched against the LoggerToMatch. If the LoggerToMatch equals the beginning of the incoming LoggerName (String.StartsWith(string)) then a match will have occurred. If no match occurs this function will return Neutral allowing other filters to check the event. If a match occurs then the value of AcceptOnMatch is checked. If it is true then Accept is returned otherwise Deny is returned.