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
                    
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" 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" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="EasyReasy.Database.Logging" />
                    
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 --version 0.1.0
                    
#r "nuget: EasyReasy.Database.Logging, 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@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&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=EasyReasy.Database.Logging&version=0.1.0
                    
Install as a Cake Tool

Back to overview

EasyReasy.Database.Logging

NuGet

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-COPY sink 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 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 (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