SmartRequestLogger 1.1.8

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

SmartRequestLogger

NuGet Build License

Lightweight ASP.NET Core middleware for structured request/response logging — correlation IDs, timing, slow-request flagging, and configurable header redaction. No dependencies beyond Microsoft.Extensions.Logging.

Why

Most request-logging setups either log too little (just status codes) or too much (raw bodies with auth tokens in them). SmartRequestLogger gives you a correlation ID per request out of the box, flags slow requests automatically, and redacts sensitive headers by default — so it's safe to drop into production without a config review.

Install

dotnet add package SmartRequestLogger

Usage

// Program.cs
builder.Services.AddSmartRequestLogger(options =>
{
    options.SlowRequestThresholdMs = 500;
    options.LogRequestBody = false; // default
    options.IgnorePaths.Add("/swagger");
});

var app = builder.Build();

app.UseSmartRequestLogger(); // place early, after exception handling middleware

app.MapControllers();
app.Run();

Every response will include an X-Correlation-ID header (generated, or propagated if the caller sent one), and logs will look like:

info: SmartRequestLogger.RequestLoggingMiddleware[0]
      => CorrelationId: 4f2a9e1b8c3d4a2e
      GET /api/orders/42 responded 200 in 34ms

Requests over the configured threshold are logged at Warning level with a [SLOW] marker, so you can filter on log level alone to find performance outliers.

Options

Option Default Description
CorrelationIdHeader X-Correlation-ID Header used to read/propagate the correlation ID
LogRequestBody false Log request body (truncated to MaxBodyLength)
LogResponseBody false Log response body (truncated to MaxBodyLength)
MaxBodyLength 2000 Max characters logged before truncation
RedactedHeaders Authorization, Cookie, Set-Cookie, X-Api-Key Headers redacted in logs
IgnorePaths /health, /favicon.ico Paths skipped entirely
SlowRequestThresholdMs 1000 Threshold to log at Warning with [SLOW] flag

Releases

Versioning is automated with Nerdbank.GitVersioning — there's no manual dotnet pack -p:Version=... or git tag step. The version comes from version.json plus the git commit height on the branch being built, and the CI workflow tags and publishes automatically on every push to main, develop, or release/*.

Unlike semantic-release, NBGV doesn't infer branch-specific prerelease labels (-pre, -rc) from a single shared config — version.json is itself versioned in git, so each branch simply carries its own copy:

Branch version.json"version" Example output
develop "1.1-pre" 1.1.0-pre.23
release/* "1.1-rc" 1.1.0-rc.4
main "1.1" 1.1.0

In practice: when you cut a release/1.1 branch from develop, edit version.json once on that branch to say "1.1-rc", commit it, and every subsequent merge into that branch is versioned and published automatically from there — no further manual steps. Same when release/1.1 merges to main: update version.json to drop the prerelease label, and main starts publishing stable 1.1.x releases.

Contributing

Issues and PRs welcome. Run tests with dotnet test from the repo root.

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 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 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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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.1.8 83 8/14/2026
1.1.7 81 8/14/2026
1.1.6 87 8/14/2026