EasyReasy.Database.Logging.AspNetCore 0.1.0

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

Back to overview

EasyReasy.Database.Logging.AspNetCore

NuGet

ASP.NET Core integration for EasyReasy.Database.Logging. Adds the two web-coupled pieces the core deliberately leaves out:

  • an HttpContext enricher that attaches the acting user id (as the UserId column) and the client IP (into properties) to operational log events;
  • opt-in admin endpoints — a paginated read and a Server-Sent Events live feed.

Installation

dotnet add package EasyReasy.Database.Logging.AspNetCore

Enrichment

builder.Services.AddOperationalLogging();
builder.Services.AddOperationalLoggingHttpContext(options =>
{
    // Default reads the standard NameIdentifier claim; override for a different claim:
    // options.ResolveUserId = ctx => ctx.User?.FindFirst("sub")?.Value;
});
builder.Host.UseOperationalLogging();

The enricher registers itself as an ILogEventEnricher, so UseOperationalLogging picks it up automatically. For the real client IP behind a reverse proxy, configure UseForwardedHeaders in your app as usual.

Admin endpoints (opt-in)

app.MapOperationalLogEndpoints()           // default prefix: /api/admin/logs
   .RequireAuthorization("Admin");         // your policy — the library does not gate

This maps:

  • GET /api/admin/logs/operational — paginated read. Query: level, sourceContext, from, to, page, perPage. Returns a PagedResult<OperationalLogEntry>. page defaults to 1; perPage defaults to 50 and is clamped to a maximum of 100 (a larger request is silently capped — TotalCount still reports the full match count).
  • GET /api/admin/logs/operational/stream — Server-Sent Events; every persisted row is pushed as a data: frame. Idle connections receive a : heartbeat comment frame roughly every 30 seconds to keep the connection alive through proxies; spec-compliant clients ignore comment frames. Pass MapOperationalLogEndpoints(heartbeatInterval: ...) to change the cadence — lower it if a reverse proxy closes idle connections in under 30 seconds.

On both payloads the properties field is serialized as a nested JSON object (the structured Serilog properties), not as an escaped JSON string — parse it directly, no second JSON.parse needed.

Don't want the ready-made surface? Skip MapOperationalLogEndpoints and consume IOperationalLogReadRepository + IOperationalLogBroadcaster directly.

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
0.1.0 41 6/5/2026