VanDerHeijden.Logging 10.0.6

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

VanDerHeijden.Logging

Core abstractions for high-performance batched logging in .NET 10.

What's in this package

  • IBatchedLogWriter<T> — implement this interface to create a custom log writer
  • BatchedLogger<T> — background consumer that batches entries and calls your writer
  • BatchedLoggerProvider<T>ILoggerProvider adapter for use with Microsoft.Extensions.Logging

This package contains no writer implementation. Install one of the writer packages instead:

Package Target
VanDerHeijden.Logging.File Daily rotating text files
VanDerHeijden.Logging.MongoDb MongoDB collection
VanDerHeijden.Logging.Sql SQL Server (SqlBulkCopy)
VanDerHeijden.Logging.Redis Redis list (RPUSH)

Implementing a custom writer

public sealed class MyWriter : IBatchedLogWriter<string>
{
    public async Task WriteBatchAsync(List<string> entries, CancellationToken ct)
    {
        // write entries to your target
    }

    public ValueTask DisposeAsync() => ValueTask.CompletedTask;
}

Register it:

builder.Logging.Services.AddSingleton<ILoggerProvider>(sp =>
{
    var httpContextAccessor = sp.GetService<IHttpContextAccessor>(); // optional
    var writer = new MyWriter();
    var logger = new BatchedLogger<string>(writer, batchSize: 200, maxIdleMs: 4000);
    return new BatchedLoggerProvider<string>(
        logger,
        entryFactory: (msg, level, ctx) => msg,
        httpContextAccessor);
});

The entryFactory receives an optional HttpLogContext with request metadata (Path, Method, ClientIp, Referer, UserAgent, SessionId). It is null when no HTTP context is active or when IHttpContextAccessor is not registered.

Repository

https://github.com/alphons/VanDerHeijden.Logging

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 (4)

Showing the top 4 NuGet packages that depend on VanDerHeijden.Logging:

Package Downloads
VanDerHeijden.Logging.MongoDb

MongoDB log writer for VanDerHeijden.Logging: writes batched log entries to a MongoDB collection.

VanDerHeijden.Logging.File

File log writer for VanDerHeijden.Logging: writes batched log entries to daily rotating text files.

VanDerHeijden.Logging.Redis

Redis log writer for VanDerHeijden.Logging: writes batched log entries to a Redis list using RPUSH.

VanDerHeijden.Logging.Sql

SQL Server log writer for VanDerHeijden.Logging: writes batched log entries to a SQL Server table using SqlBulkCopy.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.6 126 3/11/2026
10.0.5 86 3/2/2026
10.0.4 122 2/23/2026
10.0.3 115 2/23/2026
10.0.2 115 2/23/2026
10.0.1 118 2/23/2026
10.0.0 117 2/22/2026