Pragmatic.Logging
1.0.0-alpha.1
See the version list below for details.
dotnet add package Pragmatic.Logging --version 1.0.0-alpha.1
NuGet\Install-Package Pragmatic.Logging -Version 1.0.0-alpha.1
<PackageReference Include="Pragmatic.Logging" Version="1.0.0-alpha.1" />
<PackageVersion Include="Pragmatic.Logging" Version="1.0.0-alpha.1" />
<PackageReference Include="Pragmatic.Logging" />
paket add Pragmatic.Logging --version 1.0.0-alpha.1
#r "nuget: Pragmatic.Logging, 1.0.0-alpha.1"
#:package Pragmatic.Logging@1.0.0-alpha.1
#addin nuget:?package=Pragmatic.Logging&version=1.0.0-alpha.1&prerelease
#tool nuget:?package=Pragmatic.Logging&version=1.0.0-alpha.1&prerelease
Pragmatic.Logging
Feature-rich structured logging for the Pragmatic.Design ecosystem: extends .NET ILogger with
privacy-aware redaction, an audit trail, context enrichment, an expression filter DSL, and multiple
providers.
Performance: first in every benchmarked category against Serilog and NLog, with Microsoft's
[LoggerMessage]call sites a log call is allocation-free end-to-end (33.6 ns / 0 B vs ~295 ns / 712–1032 B). The pipeline defers all materialization to the sink; enabling redaction/enrichment/filters routes calls through the full pipeline. See BENCHMARK-RESULTS.md.
The Problem
Production logging needs structured output, PII redaction, correlation IDs, rate limiting, and multiple
targets. Microsoft.Extensions.Logging gives you the ILogger foundation and
leaves the rest to you. String interpolation allocates on every call (even when the level is off),
secrets leak when someone forgets to sanitize, and context must be threaded by hand.
// Without Pragmatic: allocates always, leaks PII + secrets, no context
logger.LogInformation($"Order {orderId} by {email} via {connectionString}");
The Solution
A fluent PragmaticLoggingBuilder over standard ILogger<T> (no proprietary abstraction) configures
every concern in one place: providers, presets, privacy, performance, context enrichment.
builder.Services.AddPragmaticLogging(logging => logging
.UseProductionPreset() // background processing, rate limiting, correlation IDs
.AddConsole()
.AddFile("logs/app-{Date}.log") // rolling file with retention
.EnableDataRedaction(r => r.SensitivePropertyNames = ["password", "email", "apiKey"]));
In a Pragmatic host the same builder is app.UseLogging(logging => …). There is one builder,
Pragmatic.Logging.Extensions.PragmaticLoggingBuilder; ILoggingBuilder.AddPragmaticLogging() no
longer exists.
Pair it with .NET's built-in [LoggerMessage] source generator on hot paths; structured properties,
automatic PII/secret redaction, an audit trail, and context enrichment come built in.
Installation
dotnet add package Pragmatic.Logging
Status
Functional within 1.0.0-alpha: the builder, the providers (console, rolling file, JSON, NDJSON, memory, debug, null, Windows Event Log), presets, redaction, the audit trail, rate limiting, and context enrichment. See the roadmap.
Documentation
| Guide | What you'll learn |
|---|---|
| Concepts | The builder model, presets, zero-allocation infrastructure |
| Getting Started | Configure providers and write your first structured logs |
| Providers | The eight providers, choosing one, writing your own |
| Context Enrichment | Correlation IDs, ambient context, scopes |
| Privacy & Security | PII/secret redaction, audit trail |
| Performance | [LoggerMessage], the zero-allocation formatter, rate limiting |
| Common Mistakes | The most frequent logging pitfalls |
| Troubleshooting | Problem/solution guide |
Requirements
- .NET 10.0+
License
Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Logging is MIT-licensed.
| 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
- OpenTelemetry (>= 1.15.3)
- Pragmatic.Abstractions (>= 1.0.0-alpha.1)
- Pragmatic.Redaction (>= 1.0.0-alpha.1)
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 |
|---|---|---|
| 1.0.0-alpha.6 | 160 | 11/21/2026 |
| 1.0.0-alpha.5 | 63 | 11/21/2026 |
| 1.0.0-alpha.4 | 121 | 11/16/2026 |
| 1.0.0-alpha.3 | 384 | 10/17/2026 |
| 1.0.0-alpha.2 | 126 | 10/12/2026 |
| 1.0.0-alpha.1 | 342 | 10/3/2026 |