PostSharpAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​Adapters.​Asp­Net­CoreAsp­Net­Core­LoggingInitialize
Open sandboxFocus

AspNetCoreLogging.Initialize Method

Initialize(ICorrelationProtocol, Predicate<HttpRequest>, LogEventMetadata)

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

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

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

Predicate<Microsoft.AspNetCore.Http.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>.

Type Description

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