Class CategoryFilter
- Namespace
- Microsoft.Practices.EnterpriseLibrary.Logging.Filters
- Assembly
- Microsoft.Practices.EnterpriseLibrary.Logging.dll
Represents a client-side log filter based on message category.
Either specific categories can be explicitly allowed, or specific categories can be denied.
public class CategoryFilter : LogFilter, ILogFilter
- Inheritance
-
CategoryFilter
- Implements
- Inherited Members
Constructors
CategoryFilter(string, ICollection<string>, CategoryFilterMode)
Initializes a new instance with configuration data.
public CategoryFilter(string name, ICollection<string> categoryFilters, CategoryFilterMode categoryFilterMode)
Parameters
name
stringName of this category filter.
categoryFilters
ICollection<string>Categories to be included in the filter.
categoryFilterMode
CategoryFilterModeCategoryFilterMode used to include or exclude category filters.
Properties
CategoryFilterMode
Gets the CategoryFilterMode to use for filtering.
public CategoryFilterMode CategoryFilterMode { get; set; }
Property Value
CategoryFilters
Gets the category names to filter.
public ICollection<string> CategoryFilters { get; }
Property Value
Methods
Filter(LogEntry)
Tests a log entry against the category filters.
public override bool Filter(LogEntry log)
Parameters
log
LogEntryLog entry to test.
Returns
- bool
true if the message passes through the filter and should be logged, false otherwise.
ShouldLog(IEnumerable<string>)
Tests a set of categories against the category filters.
public bool ShouldLog(IEnumerable<string> categories)
Parameters
categories
IEnumerable<string>The set of categories.
Returns
- bool
true if the message passes through the filter and should be logged, false otherwise.
ShouldLog(string)
Test a category against the category filters.
public bool ShouldLog(string category)
Parameters
category
stringThe category.
Returns
- bool
true if the category passes through the category filter, false otherwise.
Remarks
A log entry for an allowed category may be rejected if the log entry has other denied categories in its categories liset.