RepletoryLib.Logging 1.0.0

dotnet add package RepletoryLib.Logging --version 1.0.0
                    
NuGet\Install-Package RepletoryLib.Logging -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RepletoryLib.Logging" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RepletoryLib.Logging" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RepletoryLib.Logging" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RepletoryLib.Logging --version 1.0.0
                    
#r "nuget: RepletoryLib.Logging, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RepletoryLib.Logging@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RepletoryLib.Logging&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RepletoryLib.Logging&version=1.0.0
                    
Install as a Cake Tool

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.

NuGet .NET 10 License: MIT


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-ID across requests
  • User context enricher -- Adds UserId, UserName, TenantId to 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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