Oakrey.Log.Sanitizers
3.0.0
dotnet add package Oakrey.Log.Sanitizers --version 3.0.0
NuGet\Install-Package Oakrey.Log.Sanitizers -Version 3.0.0
<PackageReference Include="Oakrey.Log.Sanitizers" Version="3.0.0" />
<PackageVersion Include="Oakrey.Log.Sanitizers" Version="3.0.0" />
<PackageReference Include="Oakrey.Log.Sanitizers" />
paket add Oakrey.Log.Sanitizers --version 3.0.0
#r "nuget: Oakrey.Log.Sanitizers, 3.0.0"
#:package Oakrey.Log.Sanitizers@3.0.0
#addin nuget:?package=Oakrey.Log.Sanitizers&version=3.0.0
#tool nuget:?package=Oakrey.Log.Sanitizers&version=3.0.0
Oakrey.Log.Sanitizers
1. Overview
The "Log.Sanitizers" project provides optional secret sanitizers for Oakrey logging packages. It is intentionally separated from Oakrey.Log.Abstractions so applications that do not need cyber-security oriented log redaction can keep the default empty sanitizer and avoid regex-based overhead.
2. Features
Secret Sanitization:
- DefaultSecretSanitizer: Redacts common secret-like values before entries reach any logger sink.
- SecretSanitizationOptions: Configures replacement text, pattern timeout, and additional custom patterns.
- SecretSanitizationPattern: Adds custom regex-based redaction rules.
Built-in Rules:
- Password and token assignments such as
password=...,apiKey=..., andaccess_token=.... - Authorization bearer values.
- Connection string passwords.
- JWT-like values.
- PEM private key blocks.
3. Installation
You can install the package via NuGet Package Manager, Package Manager Console or the .NET CLI.
.NET CLI
Run the following command in your terminal:
dotnet add package Oakrey.Log.Sanitizers
Package Manager Console
Run the following command in your Package Manager Console:
Install-Package Oakrey.Log.Sanitizers
4. Usage
Oakrey.Log.Abstractions uses EmptyLogSecretSanitizer by default. Enable secret redaction explicitly when the application needs it:
LoggerFactory.SetSecretSanitizer(new DefaultSecretSanitizer());
You can customize the sanitizer:
LoggerFactory.SetSecretSanitizer(new DefaultSecretSanitizer(new SecretSanitizationOptions
{
ReplacementText = "[SECRET REMOVED]"
}));
Additional rules can be added through custom patterns:
SecretSanitizationOptions options = new();
options.AdditionalPatterns.Add(new SecretSanitizationPattern("CustomSecret", @"custom-secret-\d+"));
LoggerFactory.SetSecretSanitizer(new DefaultSecretSanitizer(options));
5. Requirements
- .NET 10 or higher
6. Project Information
- Author: Oakrey
- Company: Oakrey (Website Link)
- License: MIT
- Repository: Git Repository
- Project URL: Project Website
7. Contributing
Contributions are welcome! Feel free to open issues or submit pull requests to improve the package.
8. License
This project is licensed under the MIT License. See the LICENSE file for details.
| 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
- Oakrey.Log.Abstractions (>= 3.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.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 124 | 7/10/2026 |