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
<PackageReference Include="EasyReasy.Database.Logging.AspNetCore" Version="0.1.0" />
<PackageVersion Include="EasyReasy.Database.Logging.AspNetCore" Version="0.1.0" />
<PackageReference Include="EasyReasy.Database.Logging.AspNetCore" />
paket add EasyReasy.Database.Logging.AspNetCore --version 0.1.0
#r "nuget: EasyReasy.Database.Logging.AspNetCore, 0.1.0"
#:package EasyReasy.Database.Logging.AspNetCore@0.1.0
#addin nuget:?package=EasyReasy.Database.Logging.AspNetCore&version=0.1.0
#tool nuget:?package=EasyReasy.Database.Logging.AspNetCore&version=0.1.0
EasyReasy.Database.Logging.AspNetCore
ASP.NET Core integration for EasyReasy.Database.Logging. Adds the two web-coupled pieces the core deliberately leaves out:
- an
HttpContextenricher that attaches the acting user id (as theUserIdcolumn) and the client IP (intoproperties) 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 aPagedResult<OperationalLogEntry>.pagedefaults to 1;perPagedefaults to 50 and is clamped to a maximum of 100 (a larger request is silently capped —TotalCountstill reports the full match count).GET /api/admin/logs/operational/stream— Server-Sent Events; every persisted row is pushed as adata:frame. Idle connections receive a: heartbeatcomment frame roughly every 30 seconds to keep the connection alive through proxies; spec-compliant clients ignore comment frames. PassMapOperationalLogEndpoints(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 | 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
- EasyReasy.Database (>= 1.1.0)
- EasyReasy.Database.Logging (>= 0.1.0)
- Serilog (>= 4.3.1)
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 |