Pacem.Extensions.Logging.Http
0.10.15
See the version list below for details.
dotnet add package Pacem.Extensions.Logging.Http --version 0.10.15
NuGet\Install-Package Pacem.Extensions.Logging.Http -Version 0.10.15
<PackageReference Include="Pacem.Extensions.Logging.Http" Version="0.10.15" />
<PackageVersion Include="Pacem.Extensions.Logging.Http" Version="0.10.15" />
<PackageReference Include="Pacem.Extensions.Logging.Http" />
paket add Pacem.Extensions.Logging.Http --version 0.10.15
#r "nuget: Pacem.Extensions.Logging.Http, 0.10.15"
#:package Pacem.Extensions.Logging.Http@0.10.15
#addin nuget:?package=Pacem.Extensions.Logging.Http&version=0.10.15
#tool nuget:?package=Pacem.Extensions.Logging.Http&version=0.10.15
HTTP Logging Extensions
⚗️ ==Experimental==
⚠️ Experimental libs are discouraged to use in production.
About
Pacem.Extensions.Logging.Http provides extensions to ship your logs
to an HTTP endpoint (a webhook, a log-ingestion API, a collector, ...).
Delivery goes through an HttpClient (from IHttpClientFactory) and is
performed by a background consumer, one entry at a time, so logging calls
never block on the network.
⚠️ The
IHttpClientFactorypipeline logs its own requests under theSystem.Net.Http.*categories. Left unfiltered those entries feed straight back into this sink and amplify without bound — scope the sink to the categories you actually care about (builder.AddFilter(...)or thefilterargument) or silenceSystem.Net.Http.
⚠️ The sink does not own its
HttpClient. PointclientFactoryat a client you configured (AddHttpClient), or emit absolute URIs and headers from your converter/executor. The no-clientFactoryfallback is the defaultIHttpClientFactoryclient, which is unconfigured unless you set it up app-wide withConfigureHttpClientDefaults.
The following paragraphs exemplify the library utilization given common use cases.
How to
Add the logger to the logging builder (e.g. ILoggingBuilder). There are two
ways to describe a delivery, and two ways to supply the HttpClient.
1. Converter mode — build the request, the sink sends it
Provide a HttpRequestLogPayload -> HttpRequestMessage converter.
// Program.cs
builder.Logging.AddPacemHttpLogging(
// log line -> request
log => new HttpRequestMessage(HttpMethod.Post, "/ingest")
{
Content = JsonContent.Create(new
{
timestamp = log.Timestamp,
source = log.Name,
level = log.LogLevel.ToString(),
message = log.Message,
error = log.Exception?.ToString(),
data = log.Data
})
});
2. Executor mode — you own the send
Provide a (HttpClient, HttpRequestLogPayload) -> Task. Handy when you call an
SDK, batch differently, or need the response.
builder.Logging.AddPacemHttpLogging(
async (client, log) =>
{
using var response = await client.PostAsJsonAsync("/ingest", new
{
source = log.Name,
level = log.LogLevel.ToString(),
message = log.Message
});
response.EnsureSuccessStatusCode();
});
Supplying the HttpClient
Both modes take the same two optional arguments after the delivery delegate:
| Argument | Type | Purpose |
|---|---|---|
clientFactory |
Func<IHttpClientFactory, HttpRequestLogPayload, HttpClient> |
Picks or builds the client per entry. |
filter |
Func<HttpRequestLogPayload, bool> |
Evaluated on the payload before it is queued; return false to drop the entry. |
The recommended way to give the sink a base address, default headers, a primary
handler or Polly policies is to configure your own client and select it with
clientFactory:
builder.Services.AddHttpClient("my-logs", c =>
{
c.BaseAddress = new Uri("https://logs.example.com");
c.DefaultRequestHeaders.Add("X-Api-Key", "…");
});
builder.Logging.AddPacemHttpLogging(
log => new HttpRequestMessage(HttpMethod.Post, "/ingest") { /* … */ },
clientFactory: (factory, log) => factory.CreateClient("my-logs"),
// don't ship our own transport noise back over HTTP
filter: log => !log.Name.StartsWith("System.Net.Http"));
Without clientFactory the sink uses the default IHttpClientFactory client, so
the converter/executor must produce absolute URIs (and set any headers on the
request itself), unless you configure the default client app-wide:
builder.Services.ConfigureHttpClientDefaults(b =>
b.ConfigureHttpClient(c => c.BaseAddress = new Uri("https://logs.example.com")));
3. Full control
builder.Logging.AddPacemHttpLogging(options =>
{
options.FormatHttpRequestMessage = log => /* ... */; // or options.SendHttpLogAsync
options.CreateHttpClient = (factory, log) => factory.CreateClient("my-configured-client");
options.Filter = log => log.LogLevel >= LogLevel.Warning;
});
| Option | Purpose |
|---|---|
FormatHttpRequestMessage |
The converter. |
SendHttpLogAsync |
The executor. |
CreateHttpClient |
Per-entry client selection from the IHttpClientFactory. |
Filter |
Content predicate, evaluated before the payload is queued. |
ℹ️ Set at least one of FormatHttpRequestMessage /
SendHttpLogAsync — otherwise the sink throws on the first write.
Plans for version next
Optional client-side batching and a retry / dead-letter policy.
| 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.Http (>= 10.0.11)
- Pacem.Extensions.Logging (>= 0.10.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.10.18-selberg | 32 | 10/1/2026 |
| 0.10.18-riemann | 84 | 9/26/2026 |
| 0.10.18-pascal | 90 | 9/21/2026 |
| 0.10.17 | 94 | 9/18/2026 |
| 0.10.17-foucault | 87 | 9/18/2026 |
| 0.10.16 | 87 | 9/16/2026 |
| 0.10.16-hamilton | 80 | 9/14/2026 |
| 0.10.16-gauss | 84 | 9/14/2026 |
| 0.10.16-faraday | 95 | 9/9/2026 |
| 0.10.15 | 95 | 9/7/2026 |
| 0.10.15-euler | 86 | 9/7/2026 |
| 0.10.14 | 102 | 9/6/2026 |
| 0.10.14-dedekind | 106 | 9/6/2026 |
| 0.10.14-cauchy | 101 | 9/5/2026 |
| 0.10.14-boltzmann | 93 | 9/5/2026 |
| 0.10.13 | 104 | 9/3/2026 |
| 0.10.13-abel | 92 | 9/3/2026 |
| 0.10.12 | 89 | 9/3/2026 |
| 0.10.11 | 99 | 8/26/2026 |
| 0.10.10 | 126 | 7/28/2026 |