Open sandboxFocus

Method Initialize

Initialize(ICorrelationProtocol, Predicate<HttpRequest>, LogEventMetadata)

Instruments the ASP.NET Core stack to define new logging activity (and possibly transactions) for incoming HTTP requests.

Declaration
public static IDisposable Initialize(ICorrelationProtocol correlationProtocol = null, Predicate<HttpRequest> filter = null, LogEventMetadata metadata = null)
Parameters
Type Name Description
ICorrelationProtocol correlationProtocol

An optional implementation of ICorrelationProtocol to support distributed logging and interpret incoming request headers.

Predicate<HttpRequest> filter

An optional predicate that determines which requests must be captured. If that parameter is omitted, the paths /lib, /css and /js will be ignored.

LogEventMetadata metadata

An optional LogEventMetadata, which maps an HttpContext on a set of properties and an expression model. The default implementation is AspNetCoreRequestMetadata. You can derive this class if you want to add or remove properties. If you want to change the expression model, you have to derive the generic abstract AspNetCoreRequestMetadata<T>.

Returns
Type Description
IDisposable

An opaque IDisposable that you can dispose to stop collecting logs from ASP.NET Core.