Table of Contents

Class LoggerFilterConfiguration

Namespace
Serilog.Configuration
Assembly
Serilog.dll

Controls filter configuration.

public class LoggerFilterConfiguration
Inheritance
LoggerFilterConfiguration
Inherited Members

Methods

ByExcluding(Func<LogEvent, bool>)

Filter out log events that match a predicate.

public LoggerConfiguration ByExcluding(Func<LogEvent, bool> exclusionPredicate)

Parameters

exclusionPredicate Func<LogEvent, bool>

Function that returns true when an event should be excluded (silenced).

Returns

LoggerConfiguration

Configuration object allowing method chaining.

ByIncludingOnly(Func<LogEvent, bool>)

Filter log events to include only those that match a predicate.

public LoggerConfiguration ByIncludingOnly(Func<LogEvent, bool> inclusionPredicate)

Parameters

inclusionPredicate Func<LogEvent, bool>

Function that returns true when an event should be included (emitted).

Returns

LoggerConfiguration

Configuration object allowing method chaining.

With(params ILogEventFilter[])

Filter out log events from the stream based on the provided filter.

public LoggerConfiguration With(params ILogEventFilter[] filters)

Parameters

filters ILogEventFilter[]

The filters to apply.

Returns

LoggerConfiguration

Configuration object allowing method chaining.

Exceptions

ArgumentNullException

When filters is

null
ArgumentException

When any element of filters is

null

With<TFilter>()

Filter out log events from the stream based on the provided filter.

public LoggerConfiguration With<TFilter>() where TFilter : ILogEventFilter, new()

Returns

LoggerConfiguration

Configuration object allowing method chaining.

Type Parameters

TFilter

The filters to apply.