Soenneker.HttpClients.LoggingHandler
4.0.221
Prefix Reserved
dotnet add package Soenneker.HttpClients.LoggingHandler --version 4.0.221
NuGet\Install-Package Soenneker.HttpClients.LoggingHandler -Version 4.0.221
<PackageReference Include="Soenneker.HttpClients.LoggingHandler" Version="4.0.221" />
<PackageVersion Include="Soenneker.HttpClients.LoggingHandler" Version="4.0.221" />
<PackageReference Include="Soenneker.HttpClients.LoggingHandler" />
paket add Soenneker.HttpClients.LoggingHandler --version 4.0.221
#r "nuget: Soenneker.HttpClients.LoggingHandler, 4.0.221"
#:package Soenneker.HttpClients.LoggingHandler@4.0.221
#addin nuget:?package=Soenneker.HttpClients.LoggingHandler&version=4.0.221
#tool nuget:?package=Soenneker.HttpClients.LoggingHandler&version=4.0.221
Soenneker.HttpClients.LoggingHandler
A delegating handler for structured HTTP request, response, timing, header, and optional body logs.
Install
dotnet add package Soenneker.HttpClients.LoggingHandler
Configure with IHttpClientFactory
using Microsoft.Extensions.Logging;
using Soenneker.HttpClients.LoggingHandler;
var options = new HttpClientLoggingOptions
{
LogLevel = LogLevel.Debug,
LogRequestHeaders = true,
LogResponseHeaders = true,
LogRequestBody = false,
LogResponseBody = false
};
services.AddHttpClient("catalog", client =>
{
client.BaseAddress = new Uri("https://api.example.com/");
})
.AddHttpMessageHandler(serviceProvider =>
new HttpClientLoggingHandler(
serviceProvider.GetRequiredService<ILogger<HttpClientLoggingHandler>>(),
options));
The handler logs the method, path, status code, and elapsed time. Header logging is enabled by default. Request and response bodies and query strings are disabled by default because they commonly contain credentials or personal data.
Redaction and body limits
The default redaction list covers Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-Api-Key, and Api-Key. Replace or extend RedactedHeaders before constructing the handler for application-specific secrets.
var options = new HttpClientLoggingOptions
{
LogResponseBody = true,
MaxBodyLogLength = 8_192,
RedactedHeaders =
[
"Authorization",
"Cookie",
"Set-Cookie",
"X-Api-Key",
"X-Tenant-Token"
]
};
MaxBodyLogLength defaults to 4,096 characters. A negative value or int.MaxValue removes the limit and can buffer arbitrarily large content; use that only with payload sizes you control.
Body inspection rewinds seekable content so downstream consumers can still read it. Content with no safely bounded, seekable representation is skipped. A body-read failure is logged as a warning and does not fail the HTTP call, but caller-requested cancellation still propagates.
Set LogQueryString = true only when query parameters are known not to contain secrets. URI query values and body fields are not selectively redacted: when enabled, they are logged as supplied.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Options (>= 10.0.11)
- Soenneker.Extensions.Enumerable.String (>= 4.0.1433)
- Soenneker.Extensions.Stream (>= 4.0.147)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Soenneker.HttpClients.LoggingHandler:
| Package | Downloads |
|---|---|
|
Soenneker.GitHub.Client.Http
Provides a configured, cached HttpClient for GitHub's REST API. |
|
|
Soenneker.Cloudflare.HttpClient
An async thread-safe HttpClient singleton for the Cloudflare API |
|
|
Soenneker.Instantly.ClientUtil
Provides a lazily created Instantly generated client over a reusable authenticated transport |
|
|
Soenneker.Telnyx.Client
Provide a cached HttpClient with Telnyx REST API authentication. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.221 | 33 | 9/4/2026 |
| 4.0.220 | 94 | 9/4/2026 |
| 4.0.219 | 171 | 9/4/2026 |
| 4.0.218 | 11,208 | 8/31/2026 |
| 4.0.217 | 641 | 8/31/2026 |
| 4.0.216 | 678 | 8/31/2026 |
| 4.0.215 | 324 | 8/31/2026 |
| 4.0.214 | 4,107 | 8/30/2026 |
| 4.0.213 | 146 | 8/30/2026 |
| 4.0.212 | 320 | 8/30/2026 |
| 4.0.211 | 220 | 8/30/2026 |
| 4.0.210 | 1,704 | 8/29/2026 |
| 4.0.209 | 20,546 | 8/26/2026 |
| 4.0.208 | 333 | 8/25/2026 |
| 4.0.207 | 117 | 8/25/2026 |
| 4.0.206 | 5,201 | 8/22/2026 |
| 4.0.205 | 7,473 | 8/18/2026 |
| 4.0.204 | 10,964 | 8/13/2026 |
| 4.0.203 | 313 | 8/13/2026 |
| 4.0.202 | 1,566 | 8/12/2026 |
Updated Multiple NuGet packages