-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed as not planned
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-Extensions-HttpClientFactory
Milestone
Description
Hi,
I saw this issue for overriding the default logging / altering the log statements emitted when doing requests using a HttpClientFactory based HttpClient, which recommends re-implementing the IHttpMessageHandlerBuilderFilter for this.
I wanted 2 alterations from the default logging, to reduce the logs:
- Don't emit 2 log statements for each request, but only one (the default logging emits a start-req, and a end-req log statement)
- In the single emitted log statement, include the request url.
So reducing this:
- "Sending HTTP request {HttpMethod} {Uri}");
- "Received HTTP response headers after {ElapsedMilliseconds}ms - {StatusCode}"
to
- $"{HttpMethod} {Uri} - {StatusCode} in {ElapsedMilliseconds}ms"
I was surprised by the amount of code I had to write to be able to do this. Is there no easier way to just modify the default log statements..?
Deilan, isaalx, timba, johnkors, CDuke and 5 more
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-Extensions-HttpClientFactory