PrimusSaaS.Logging
1.2.6
dotnet add package PrimusSaaS.Logging --version 1.2.6
NuGet\Install-Package PrimusSaaS.Logging -Version 1.2.6
<PackageReference Include="PrimusSaaS.Logging" Version="1.2.6" />
<PackageVersion Include="PrimusSaaS.Logging" Version="1.2.6" />
<PackageReference Include="PrimusSaaS.Logging" />
paket add PrimusSaaS.Logging --version 1.2.6
#r "nuget: PrimusSaaS.Logging, 1.2.6"
#:package PrimusSaaS.Logging@1.2.6
#addin nuget:?package=PrimusSaaS.Logging&version=1.2.6
#tool nuget:?package=PrimusSaaS.Logging&version=1.2.6
PrimusSaaS.Logging - Enterprise Logging for .NET
Package version: 1.2.4
Enterprise-grade structured logging library for .NET applications with automatic context enrichment, PII masking, and multiple output targets.
Recommendation: For vendor-neutral metrics and distributed tracing (OpenTelemetry), use the new PrimusSaaS.Observability module. Use this package (PrimusSaaS.Logging) if you specifically require local PII masking or custom file rotation sinks.
Features
- Structured Logging - JSON-formatted logs with rich context
- Log Levels - DEBUG, INFO, WARNING, ERROR, CRITICAL
- Multiple Targets - Console, File, Azure Application Insights
- PII Masking - Automatic redaction of sensitive data
- File Rotation - Size-based rotation with gzip compression
- Async Buffering - High-performance non-blocking logging
- Custom Enrichers - Add dynamic context to every log
- Standard ILogger - Full compatibility with Microsoft.Extensions.Logging
- Serilog/NLog Bridge - Forward enriched logs into existing sink ecosystems
- ASP.NET Core Integration - Middleware for automatic HTTP context enrichment
Installation
dotnet add package PrimusSaaS.Logging
Quick Start
Register Services
using PrimusSaaS.Logging.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddPrimus(builder.Configuration.GetSection("PrimusLogging"));
var app = builder.Build();
app.UsePrimusLogging();
app.Run();
Performance
- Async Buffering: Non-blocking writes with configurable buffer size.
- Thread-Safe: Lock-free reads, minimal contention.
- Compression: Gzip reduces storage by ~70%.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net6.0
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Routing (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- Microsoft.Extensions.Primitives (>= 6.0.0)
- NLog (>= 5.2.8)
- Serilog (>= 2.12.0)
- System.Diagnostics.DiagnosticSource (>= 6.0.0)
- System.Drawing.Common (>= 8.0.0)
-
net7.0
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Routing (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
- Microsoft.Extensions.Primitives (>= 7.0.0)
- NLog (>= 5.2.8)
- Serilog (>= 2.12.0)
- System.Diagnostics.DiagnosticSource (>= 7.0.0)
- System.Drawing.Common (>= 8.0.0)
-
net8.0
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Routing (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Primitives (>= 8.0.0)
- NLog (>= 5.2.8)
- Serilog (>= 2.12.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
- System.Drawing.Common (>= 8.0.0)
-
net9.0
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Routing (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Primitives (>= 9.0.0)
- NLog (>= 5.2.8)
- Serilog (>= 2.12.0)
- System.Diagnostics.DiagnosticSource (>= 9.0.0)
- System.Drawing.Common (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.2.6:
- SECURITY: Added phone number masking (MaskPhones, default: true).
- SECURITY: Added IP address masking (MaskIPs, default: false — opt in for GDPR).
- SECURITY: Pinned System.Drawing.Common 8.0.0+ to eliminate NU1904 CVE warning.
- FIX: LogAuditAsync() extension now works on ILogger<T> and ILogger (not just internal Logger type).
- FIX: LogAuditExtensions namespace changed to PrimusSaaS.Logging.Extensions — matches the using statement in all docs.
- DOCS: Console guide updated — documented dual-output format for Pretty:true.
- DOCS: All version references updated to 1.2.6 across all doc pages.
- DOCS: Fixed TargetOptions → TargetConfig in troubleshooting.md code sample.
- TESTS: 6 new unit tests for phone/IP masking — 45/45 passing.
v1.2.5:
- DOCS: Fixed missing DI registration example in console guide (OrderService not wired).
- DOCS: Fixed sampling config — added appsettings.json approach alongside code approach.
- DOCS: Fixed enrichers section — clarified both using statements required.
- DOCS: Removed duplicate Next Steps section in overview.
v1.2.4:
- E2E tested: All endpoint tests passing with structured logging, correlation IDs, and PII masking.
- Verified API accuracy: UsePrimusLogging, LogLevel integration, async buffering.
- Production-ready with comprehensive copy-paste code samples.
v1.2.3:
- DOCS: Comprehensive documentation update with accurate implementation examples and best practices.
- Improved developer experience with clear migration guides and copy-paste ready samples.
v1.2.2: Resolved duplicate UsePrimusLogging extension ambiguity; safe serialization; scopes + correlation IDs; async buffering with metrics.