Share via


IHttpLoggingInterceptor.OnRequestAsync(HttpLoggingInterceptorContext) Method

Definition

A callback to customize the logging of the request and response.

public System.Threading.Tasks.ValueTask OnRequestAsync (Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext logContext);
abstract member OnRequestAsync : Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext -> System.Threading.Tasks.ValueTask
Public Function OnRequestAsync (logContext As HttpLoggingInterceptorContext) As ValueTask

Parameters

Returns

Remarks

This is called when the request is first received and can be used to configure both request and response options. All settings will carry over to OnResponseAsync(HttpLoggingInterceptorContext) except the Parameters will be cleared after logging the request. LoggingFields may be changed per request to control the logging behavior. If no request fields are enabled, and the Parameters collection is empty, no request logging will occur. If CombineLogs is enabled then Parameters will carry over from the request to response and be logged together.

Applies to