SimpleW.Helper.FileLogSink 26.2.0-alpha.20261115-2395

This is a prerelease version of SimpleW.Helper.FileLogSink.
dotnet add package SimpleW.Helper.FileLogSink --version 26.2.0-alpha.20261115-2395
                    
NuGet\Install-Package SimpleW.Helper.FileLogSink -Version 26.2.0-alpha.20261115-2395
                    
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="SimpleW.Helper.FileLogSink" Version="26.2.0-alpha.20261115-2395" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleW.Helper.FileLogSink" Version="26.2.0-alpha.20261115-2395" />
                    
Directory.Packages.props
<PackageReference Include="SimpleW.Helper.FileLogSink" />
                    
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 SimpleW.Helper.FileLogSink --version 26.2.0-alpha.20261115-2395
                    
#r "nuget: SimpleW.Helper.FileLogSink, 26.2.0-alpha.20261115-2395"
                    
#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 SimpleW.Helper.FileLogSink@26.2.0-alpha.20261115-2395
                    
#: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=SimpleW.Helper.FileLogSink&version=26.2.0-alpha.20261115-2395&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SimpleW.Helper.FileLogSink&version=26.2.0-alpha.20261115-2395&prerelease
                    
Install as a Cake Tool

SimpleW.Helper.FileLogSink

website

License NuGet Downloads

<br/> Linux MacOS Windows (Visual Studio)

Buffered file logging for SimpleW, with a bounded queue and one background writer.

Features

  • UTF-8 text logs with timestamps, levels, sources, trace/span IDs and exceptions.
  • UTC hourly or daily rotation, optionally combined with an approximate file size limit.
  • Optional retention by file count.
  • Batched writes, periodic flushing and explicit asynchronous flushing.
  • Supports .NET 8, .NET 9 and .NET 10.

Installation

Add a package reference to your project:

<PackageReference Include="SimpleW.Helper.FileLogSink" Version="26.2.0" />

The addon depends on SimpleW 26.2.x and has no additional third-party dependencies.

Getting started

Construct the sink, then register fileSink.Write with Log.AddSink. The constructor opens the file and reports startup errors before returning. No initial FlushAsync() call is needed.

using SimpleW.Helper.FileLogSink;
using SimpleW.Observability;

// 1. Open the file and start the background writer.
await using FileLogSink fileSink = new(new FileLogSinkOptions {
    FilePath = "logs/server.log",
    RollingInterval = FileLogRollingInterval.Day,
    MaxFileSizeBytes = 100L * 1024 * 1024,
    RetainedFileCountLimit = 30
});

// 2. Send SimpleW logs to this sink.
Log.AddSink(fileSink.Write);

// 3. start using log
Log.Info("MyApp", "Application started");

await using awaits disposal at the end of the scope; construction is synchronous.

By default, the sink rotates daily in UTC and at an estimated 100 MiB, flushes every second and retains all old files. Set RetainedFileCountLimit to enable deletion of old files. Size is estimated as one byte per UTF-16 character in the complete formatted log. Non-ASCII text can exceed this estimate. Rotation never splits an entry. A buffered StreamWriter handles UTF-8 encoding and groups file writes.

Use one sink/process for each base path. When the queue is full, producers wait for space. Stop producers and unregister the sink before disposal. FlushAsync flushes file buffers without forcing a durable hardware write; abrupt termination can lose buffered events. Background failures are exposed through LastError and propagated by writes, flushes and disposal.

Migration from the core library

Reference this addon and replace the import used for the three file sink types with using SimpleW.Helper.FileLogSink;. Keep using SimpleW.Observability; for logging APIs such as Log and LogEntry.

Documentation

See the FileLogSink addon documentation for usage, rotation, retention and the complete API reference.

Changelog

See changelog.md.

License

MIT.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • SimpleW (>= 26.2.0-alpha.20261115-2395)
  • net11.0

    • SimpleW (>= 26.2.0-alpha.20261115-2395)
  • net8.0

    • SimpleW (>= 26.2.0-alpha.20261115-2395)
  • net9.0

    • SimpleW (>= 26.2.0-alpha.20261115-2395)

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
26.2.0-alpha.20261115-2395 63 11/15/2026
26.2.0-alpha.20261112-2357 54 11/12/2026
26.1.0-alpha.20261031-2305 69 10/31/2026
26.1.0-alpha.20260927-2283 72 9/27/2026