EasyReasy.Database.Logging
0.1.0
dotnet add package EasyReasy.Database.Logging --version 0.1.0
NuGet\Install-Package EasyReasy.Database.Logging -Version 0.1.0
<PackageReference Include="EasyReasy.Database.Logging" Version="0.1.0" />
<PackageVersion Include="EasyReasy.Database.Logging" Version="0.1.0" />
<PackageReference Include="EasyReasy.Database.Logging" />
paket add EasyReasy.Database.Logging --version 0.1.0
#r "nuget: EasyReasy.Database.Logging, 0.1.0"
#:package EasyReasy.Database.Logging@0.1.0
#addin nuget:?package=EasyReasy.Database.Logging&version=0.1.0
#tool nuget:?package=EasyReasy.Database.Logging&version=0.1.0
EasyReasy.Database.Logging
Database-agnostic operational logging for .NET, built on Serilog. It persists structured application / observability log events to a SQL table through a batched, best-effort sink, and gives you a paginated read surface plus an in-process live feed for an admin log viewer.
Your existing ILogger<T> call sites are unchanged — Serilog is installed as the logging provider and sits behind them.
This is the provider-agnostic core. It writes via a portable multi-row
INSERT(through EasyReasy.Database.Mapping), so it runs on any provider. For PostgreSQL, also add EasyReasy.Database.Logging.Npgsql for the faster binary-COPYsink and monthly-partition retention. For request-scoped user/IP enrichment and ready-made admin HTTP endpoints, add EasyReasy.Database.Logging.AspNetCore.
Installation
dotnet add package EasyReasy.Database.Logging
Quick start
// A DbDataSource must already be registered (e.g. via your EasyReasy.Database setup).
builder.Services.AddOperationalLogging(options =>
{
options.TableName = "operational_log"; // default
options.MinimumLevelOverrides["Microsoft.AspNetCore"] = LogEventLevel.Warning;
});
builder.Host.UseOperationalLogging(); // installs Serilog as the ILogger provider
That's it — every _logger.LogInformation(...) now batches to the table, with the trace id attached as CorrelationId and a parallel console sink as a database-outage safety net.
Reading logs back
Inject IOperationalLogReadRepository for a paginated, filterable read:
PagedResult<OperationalLogEntry> page = await readRepository.GetAsync(
new OperationalLogFilters { Level = "Error" },
page: 1,
perPage: 50);
Live feed
The sink publishes every persisted row to IOperationalLogBroadcaster (in-process, in-memory). Subscribe to stream rows to a live admin view (the AspNetCore package ships a ready-made SSE endpoint over this).
The table
The core does not own your schema — create the table in your own migration. Columns: id, created_at, level, source_context, message, message_template, exception, correlation_id, user_id, properties. The portable sink binds properties as JSON-in-text; on PostgreSQL with a jsonb column use the Npgsql package, whose COPY sink binds jsonb natively (it also ships the partitioned DDL).
What's logged where
Routing is by Serilog convention — everything flows to the operational table. This package intentionally has no audit / compliance semantics; it's for operational observability only.
| 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.Mapping (>= 1.3.0)
- Serilog (>= 4.3.1)
- Serilog.Extensions.Hosting (>= 10.0.0)
- Serilog.Sinks.Console (>= 6.1.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on EasyReasy.Database.Logging:
| Package | Downloads |
|---|---|
|
EasyReasy.Database.Logging.Npgsql
PostgreSQL fast path for EasyReasy.Database.Logging: a binary COPY sink for high-throughput bulk insert of operational log events, monthly range-partition retention, and the partitioned table DDL. Drop-in alongside the agnostic core. |
|
|
EasyReasy.Database.Logging.AspNetCore
ASP.NET Core integration for EasyReasy.Database.Logging: an HttpContext enricher that attaches the acting user id and client IP to operational log events, plus opt-in admin endpoints (paginated read + Server-Sent Events live feed). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 44 | 6/5/2026 |