RepletoryLib.Logging
1.0.0
dotnet add package RepletoryLib.Logging --version 1.0.0
NuGet\Install-Package RepletoryLib.Logging -Version 1.0.0
<PackageReference Include="RepletoryLib.Logging" Version="1.0.0" />
<PackageVersion Include="RepletoryLib.Logging" Version="1.0.0" />
<PackageReference Include="RepletoryLib.Logging" />
paket add RepletoryLib.Logging --version 1.0.0
#r "nuget: RepletoryLib.Logging, 1.0.0"
#:package RepletoryLib.Logging@1.0.0
#addin nuget:?package=RepletoryLib.Logging&version=1.0.0
#tool nuget:?package=RepletoryLib.Logging&version=1.0.0
RepletoryLib.Logging
Structured logging with Serilog, custom enrichers, and PII-safe destructuring.
Part of the RepletoryLib ecosystem -- standalone, reusable .NET 10 libraries with zero business logic.
Overview
RepletoryLib.Logging provides production-ready structured logging using Serilog with built-in enrichers for correlation IDs, user context, and tenant information. It includes a PII-safe destructuring policy that automatically redacts fields marked with [PiiField].
Key Features
- Serilog integration -- Console, File, and Seq sinks with rolling file support
- Correlation ID enricher -- Tracks
X-Correlation-IDacross requests - User context enricher -- Adds
UserId,UserName,TenantIdto every log entry - PII-safe destructuring -- Auto-redacts
[PiiField]-marked properties in structured logs - Configurable -- Minimum level, sinks, and retention via
appsettings.json
Installation
dotnet add package RepletoryLib.Logging
Dependencies
| Package | Type |
|---|---|
RepletoryLib.Common |
RepletoryLib |
Serilog.AspNetCore |
NuGet |
Serilog.Sinks.Console |
NuGet |
Serilog.Sinks.File |
NuGet |
Serilog.Sinks.Seq |
NuGet |
Quick Start
using RepletoryLib.Logging;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseRepletoryLogging(builder.Configuration);
builder.Services.AddRepletoryLogging(builder.Configuration);
{
"Logging": {
"MinimumLevel": "Information",
"ServiceName": "MyApp",
"EnableConsole": true,
"EnableFile": true,
"FilePath": "logs/app-.txt",
"RetainedDays": 30,
"EnableSeq": false,
"SeqUrl": "http://localhost:5341"
}
}
Configuration
LoggingOptions
| Property | Type | Default | Description |
|---|---|---|---|
MinimumLevel |
string |
"Information" |
Serilog minimum log level |
ServiceName |
string |
"RepletoryService" |
Service name in structured logs |
EnableConsole |
bool |
true |
Enable console sink |
EnableFile |
bool |
true |
Enable rolling file sink |
FilePath |
string |
"logs/log-.txt" |
File path with rolling pattern |
RetainedDays |
int |
30 |
Days to keep log files |
EnableSeq |
bool |
false |
Enable Seq sink |
SeqUrl |
string? |
null |
Seq server URL |
Usage Examples
Correlation ID Tracking
Every log entry automatically includes the correlation ID from the X-Correlation-ID header:
[14:30:00 INF] Processing order {OrderId} [CorrelationId: abc-123-def]
User Context in Logs
Every log entry includes the authenticated user's context:
[14:30:00 INF] Order created [UserId: user-001, UserName: John, TenantId: tenant-001]
PII-Safe Logging
Properties marked with [PiiField] are automatically redacted in structured logs:
public class Customer
{
public string Name { get; set; }
[PiiField]
public string Email { get; set; }
[PiiField]
public string IdNumber { get; set; }
}
_logger.LogInformation("Customer registered: {@Customer}", customer);
// Output: Customer registered: { Name: "John Doe", Email: "[REDACTED]", IdNumber: "[REDACTED]" }
Integration with Other RepletoryLib Packages
| Package | Relationship |
|---|---|
RepletoryLib.Common |
ICurrentUserService, ICurrentTenantService for enrichers |
RepletoryLib.Api.Middleware |
CorrelationIdMiddleware sets the correlation ID; RequestLoggingMiddleware uses Serilog |
RepletoryLib.Data.Interceptors |
[PiiField] attribute shared for consistent PII handling |
RepletoryLib.Tracing |
Correlation IDs bridge logging and distributed tracing |
License
This project is licensed under the MIT License.
Copyright (c) 2024-2026 Repletory.
For complete documentation, infrastructure setup, and configuration reference, see the RepletoryLib main repository.
| 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
- RepletoryLib.Common (>= 1.0.0)
- Serilog (>= 4.2.0)
- Serilog.AspNetCore (>= 8.0.3)
- Serilog.Enrichers.Environment (>= 3.0.1)
- Serilog.Enrichers.Process (>= 3.0.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Extensions.Hosting (>= 8.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
- Serilog.Sinks.File (>= 6.0.0)
- Serilog.Sinks.Seq (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RepletoryLib.Logging:
| Package | Downloads |
|---|---|
|
RepletoryLib.Api.Middleware
ASP.NET Core middleware suite for RepletoryLib |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 82 | 3/2/2026 |