solrevdev.Logging.AspNetCore 1.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package solrevdev.Logging.AspNetCore --version 1.0.0
                    
NuGet\Install-Package solrevdev.Logging.AspNetCore -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="solrevdev.Logging.AspNetCore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="solrevdev.Logging.AspNetCore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="solrevdev.Logging.AspNetCore" />
                    
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 solrevdev.Logging.AspNetCore --version 1.0.0
                    
#r "nuget: solrevdev.Logging.AspNetCore, 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 solrevdev.Logging.AspNetCore@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=solrevdev.Logging.AspNetCore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=solrevdev.Logging.AspNetCore&version=1.0.0
                    
Install as a Cake Tool

Solrevdev.Logging.AspNetCore

Shared Serilog request-logging infrastructure for ASP.NET Core, extracted from three internal applications that had each hand-copied and then diverged from the same code.

Install:

dotnet add package solrevdev.Logging.AspNetCore

Wire it up. The order is not a style preference; each step below is load bearing.

builder.Services.AddSolrevdevRequestLogging();

app.UseForwardedHeaders();          // your policy, not this package's
app.UseSolrevdevClientLogContext(); // ClientIp and TraceId, above anything that short-circuits
app.UseSolrevdevRequestLogging();   // Serilog's one-line request summary
app.UseStaticFiles();
app.UseRouting();
app.UseRateLimiter();
app.UseAuthentication();
app.UseSolrevdevUserLogContext();   // UserId and UserEmail, in the one-line window
app.UseAuthorization();

What you get

  • ClientIp rendered so a person can read it. A dual-stack socket delivers an IPv4 caller as ::ffff:203.0.113.42 and a local one as ::1; both become the dotted form, so one filter finds one caller. All of 127.0.0.0/8 collapses to 127.0.0.1, a link-local address keeps its zone suffix, and a public IPv6 address passes through untouched rather than being run through MapToIPv4, which would silently return a wrong but plausible IPv4 address.
  • ForwardedFor reassembled from what the caller actually claimed. UseForwardedHeaders consumes the entries it accepts, so reading the header afterwards yields nothing or a leftover. This puts the claim back beside the settled address, which is what makes a mismatch visible.
  • Referer with its query string removed. Password-reset and email-confirmation tokens ride in that query string, and a browser sends the page it came from as the next request's Referer.
  • UserId and UserEmail on every event inside an authenticated request, pushed onto Serilog's LogContext so no call site changes. Anonymous requests carry neither property rather than carrying nulls, because an absent property is filterable and an empty one is not.
  • Static files, /healthcheck and /version demoted to Verbose when they succeed, and left alone when they fail.
  • LoggingContract, the property names as constants and as sets, so each application can test that its own request summaries still carry them.

What it deliberately does not do

No rate limiting, no throttling, no ForwardedHeadersOptions policy, and nothing that keys off an address for anything but a log property. Those are the consuming application's decisions. The address this package renders is reshaped to be readable, which is exactly wrong for a partition key: never use it for a rate limit, a throttle, a cache partition, an authorisation decision or a persisted column. It reads identically to the raw address for every caller arriving in native, non-mapped, non-loopback form, which is what lets that mistake survive testing.

Full documentation: https://github.com/solrevdev/solrevdev.logging

MIT licensed.

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

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.0 99 9/8/2026
1.0.0 88 9/8/2026