Share via


HttpLoggingInterceptorContext Class

Definition

The context used for IHttpLoggingInterceptor.

public sealed class HttpLoggingInterceptorContext
type HttpLoggingInterceptorContext = class
Public NotInheritable Class HttpLoggingInterceptorContext
Inheritance
HttpLoggingInterceptorContext

Remarks

Settings will be pre-initialized with the relevant values from HttpLoggingOptions and updated with endpoint specific values from HttpLoggingAttribute or WithHttpLogging<TBuilder>(TBuilder, HttpLoggingFields, Nullable<Int32>, Nullable<Int32>). All settings can be modified per request. All settings will carry over from OnRequestAsync(HttpLoggingInterceptorContext) to OnResponseAsync(HttpLoggingInterceptorContext) except the Parameters which are cleared after logging the request.

Constructors

HttpLoggingInterceptorContext()

Properties

HttpContext

The request context.

LoggingFields

Gets or sets which parts of the request and response to log.

Parameters

Gets a list of parameters that will be logged as part of the request or response. Values specified in LoggingFields will be added automatically after all interceptors run. All values are cleared after logging the request. All other relevant settings will carry over to the response.

RequestBodyLogLimit

Gets or sets the maximum number of bytes of the request body to log.

ResponseBodyLogLimit

Gets or sets the maximum number of bytes of the response body to log.

Methods

AddParameter(String, Object)

Adds data that will be logged as part of the request or response. See Parameters.

Disable(HttpLoggingFields)

Removes the given fields from what's currently enabled in LoggingFields.

Enable(HttpLoggingFields)

Adds the given fields to what's currently enabled in LoggingFields.

IsAnyEnabled(HttpLoggingFields)

Checks if any of the given fields are currently enabled in LoggingFields.

TryDisable(HttpLoggingFields)

Disables the given fields if any are currently enabled in LoggingFields.

Applies to