Dloizides.CommandLogging 1.0.0

dotnet add package Dloizides.CommandLogging --version 1.0.0
                    
NuGet\Install-Package Dloizides.CommandLogging -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="Dloizides.CommandLogging" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dloizides.CommandLogging" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Dloizides.CommandLogging" />
                    
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 Dloizides.CommandLogging --version 1.0.0
                    
#r "nuget: Dloizides.CommandLogging, 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 Dloizides.CommandLogging@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=Dloizides.CommandLogging&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Dloizides.CommandLogging&version=1.0.0
                    
Install as a Cake Tool

Dloizides.CommandLogging

Shared FastEndpoints command-pipeline logger with secret redaction. Logs each command's name and property values and times its execution — but redacts values of sensitive-looking properties (password/secret/token/apikey/pin/…) so they never reach stdout.

Extracted from three services (Questioner, OnlineMenu, Kefi) that had each hand-copied the middleware. Two of the copies still logged secrets in plaintext; this package canonicalises on the redacting version so the fix lives in one place.

Install

<PackageReference Include="Dloizides.CommandLogging" />

Use

Register it in the FastEndpoints command-middleware pipeline:

using Dloizides.CommandLogging;

builder.Services
    .AddFastEndpoints()
    .AddCommandMiddleware(c => c.AddCommandLogging());

That registers the open-generic CommandLogger<TCommand, TResult> for every command.

Extending the redaction list

The redaction list is the central choke point. Add fragments at startup:

using Dloizides.CommandLogging;

// e.g. before building the app
SensitivePropertyNames.AddFragment("ssn");
SensitivePropertyNames.AddFragment("iban");

Matching is case-insensitive substring, so AddFragment("ssn") also redacts SocialSecurityNumber if that contains ssn — pick fragments accordingly.

API

Member Purpose
CommandLogger<TCommand, TResult> The ICommandMiddleware implementation.
CommandMiddlewareConfig.AddCommandLogging() Registers the middleware.
SensitivePropertyNames.IsSensitive(name) The redaction predicate.
SensitivePropertyNames.AddFragment(fragment) Extends the redaction list at startup.
SensitivePropertyNames.DefaultFragments The built-in fragment list.
SensitivePropertyNames.RedactedPlaceholder The *** substitute token.

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 257 7/17/2026