RManniBucau.Logging.RollingFile 0.0.4

dotnet add package RManniBucau.Logging.RollingFile --version 0.0.4                
NuGet\Install-Package RManniBucau.Logging.RollingFile -Version 0.0.4                
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="RManniBucau.Logging.RollingFile" Version="0.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RManniBucau.Logging.RollingFile --version 0.0.4                
#r "nuget: RManniBucau.Logging.RollingFile, 0.0.4"                
#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.
// Install RManniBucau.Logging.RollingFile as a Cake Addin
#addin nuget:?package=RManniBucau.Logging.RollingFile&version=0.0.4

// Install RManniBucau.Logging.RollingFile as a Cake Tool
#tool nuget:?package=RManniBucau.Logging.RollingFile&version=0.0.4                

RManniBucau.Logging.RollingFile

Integrates with Microsoft.Extensions.Logging to provide a file based logger provider with rotation (per date and approximative size) and archiving in gzip.

Usage

var options = new RollingFileOptions
{
    Directory = _dir,
    //...
};
_factory = LoggerFactory.Create(builder =>
{
    builder.AddProvider(new RollingFileProvider(options));
});

Configuration

The configuration is centralized in RollingFileOptions:

Name Summary Default
Archive Are older than last files archives in gzip format. True
BufferSize How many chars to keep in memory before forcing a flush. This is indicative, the first time a message is read and lead to a buffer over this value will trigger a flush. 8192
Directory Directory to store logs and archives in. Note that directory MUST exist. .
Filename log (archive without extension) filename pattern, it can use {date} and {counter} templates. log-{date}-{counter}.log
ForcedFlushTimeoutMillis How long to await before forcing a flush if no message comes in. 30000
MaxDays How many archive days to keep is enabled. 7
MaxFileSize Max size of a single uncompressed file (in UTF-8 chars). 52428800
TimeProvider For very advanced cases, a custom time provider - which can be optimized compared to default DateTime.Now. () => DateTime.Now
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.4 113 9/8/2024
0.0.3 139 8/24/2024
0.0.2 128 8/24/2024
0.0.1 128 8/24/2024