次の方法で共有


IHttpClientLogger Interface

Definition

An abstraction for custom HTTP request logging for a named HttpClient instances returned by IHttpClientFactory.

public interface class IHttpClientLogger
public interface IHttpClientLogger
type IHttpClientLogger = interface
Public Interface IHttpClientLogger
Derived

Remarks

It is up to the user implementing the interface to decide where (to ILogger, or anything else) and what exactly to log. However, the implementation should be mindful about potential adverse side effects of accessing some of the HttpRequestMessage or HttpResponseMessage properties, such as reading from a content stream; if possible, such behavior should be avoided.

Logging implementation also should not throw any exceptions, as an unhandled exception in logging would fail the request.

Methods

LogRequestFailed(Object, HttpRequestMessage, HttpResponseMessage, Exception, TimeSpan)

Logs the exception happened while sending an HTTP request.

LogRequestStart(HttpRequestMessage)

Logs before sending an HTTP request.

LogRequestStop(Object, HttpRequestMessage, HttpResponseMessage, TimeSpan)

Logs after receiving an HTTP response.

Applies to