PayrollEngine.Serilog
0.10.0-beta.1
dotnet add package PayrollEngine.Serilog --version 0.10.0-beta.1
NuGet\Install-Package PayrollEngine.Serilog -Version 0.10.0-beta.1
<PackageReference Include="PayrollEngine.Serilog" Version="0.10.0-beta.1" />
<PackageVersion Include="PayrollEngine.Serilog" Version="0.10.0-beta.1" />
<PackageReference Include="PayrollEngine.Serilog" />
paket add PayrollEngine.Serilog --version 0.10.0-beta.1
#r "nuget: PayrollEngine.Serilog, 0.10.0-beta.1"
#:package PayrollEngine.Serilog@0.10.0-beta.1
#addin nuget:?package=PayrollEngine.Serilog&version=0.10.0-beta.1&prerelease
#tool nuget:?package=PayrollEngine.Serilog&version=0.10.0-beta.1&prerelease
Payroll Engine Serilog
Part of the Payroll Engine open-source payroll automation framework. Full documentation at payrollengine.org.
Serilog logging extension for the Payroll Engine. This library provides a bridge between the Payroll Engine ILogger interface and Serilog, enabling structured logging through Serilog's rich ecosystem of sinks and enrichers.
Features
- Adapter implementation of
PayrollEngine.ILoggerusing Serilog - Configuration-based setup via
IConfiguration(appsettings.json) - Support for all log levels: Trace, Debug, Information, Warning, Error, Critical
- Structured logging with message templates and property values
NuGet Package
Available on NuGet.org:
dotnet add package PayrollEngine.Serilog
Usage
Setup
Register Serilog in your application startup using the SetupSerilog extension method:
using PayrollEngine.Serilog;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.SetupSerilog(); // configures Serilog and registers PayrollLog as ILogger
var app = builder.Build();
// ensure logs are flushed on shutdown
app.Lifetime.ApplicationStopped.Register(global::Serilog.Log.CloseAndFlush);
app.Run();
SetupSerilog() does two things:
- Initialises
Serilog.Log.Loggerfrom theIConfiguration(reads theSerilogsection ofappsettings.json). - Registers a
PayrollLoginstance as the activePayrollEngine.Loglogger so that all PE log calls are routed through Serilog.
Configuration
Configure Serilog in your appsettings.json:
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "logs/payroll-.log",
"rollingInterval": "Day",
"retainedFileCountLimit": 7
}
}
]
}
}
Logging
Use the Payroll Engine Log class anywhere in your application:
using PayrollEngine;
Log.Information("Processing payroll for {TenantId}", tenantId);
Log.Warning("Retro payrun triggered for {EmployeeId}", employeeId);
Log.Error(exception, "Payroll calculation failed for {EmployeeId}", employeeId);
Shutdown
To ensure all buffered log events are written to sinks, call CloseAndFlush when the application shuts down:
global::Serilog.Log.CloseAndFlush();
Log Level Mapping
PayrollLog maps each PayrollEngine.ILogger method to the corresponding Serilog level:
| PE method / LogLevel | Serilog LogEventLevel |
|---|---|
Trace |
Verbose |
Debug |
Debug |
Information |
Information |
Warning |
Warning |
Error |
Error |
Critical |
Fatal |
The generic Write(LogLevel level, ...) overload casts the PE LogLevel enum value directly to Serilog.Events.LogEventLevel, so numeric values must match when using Write with an explicit level.
Architecture
The library consists of two components:
PayrollLog— ImplementsPayrollEngine.ILoggerand delegates all logging calls to the staticSerilog.Log.Logger.ConfigurationExtensions— Provides theSetupSerilog()extension method onIConfigurationthat initialises Serilog from configuration and registersPayrollLogas the activePayrollEngine.Loglogger viaLog.SetLogger().
Build
dotnet build -c Release
dotnet pack -c Release
Environment variable used during build:
| Variable | Description |
|---|---|
PayrollEnginePackageDir |
Output directory for the NuGet package (optional) |
Third Party Components
- Logging with Serilog — license
Apache 2.0
See Also
- Payroll Engine Backend — uses this library
- Payroll Engine WebApp — uses this library
- Payroll Engine Console — uses this library
- Serilog documentation — sinks, enrichers, configuration
| 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
- PayrollEngine.Core (>= 0.10.0-beta.1)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Settings.AppSettings (>= 3.0.0)
- Serilog.Settings.Configuration (>= 10.0.0)
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.10.0-beta.1 | 39 | 3/9/2026 |
| 0.9.0-beta.17 | 71 | 2/18/2026 |
| 0.9.0-beta.16 | 62 | 2/11/2026 |
| 0.9.0-beta.15 | 55 | 2/5/2026 |
| 0.9.0-beta.14 | 72 | 1/14/2026 |
| 0.9.0-beta.13 | 81 | 1/7/2026 |
| 0.9.0-beta.12 | 211 | 11/5/2025 |
| 0.9.0-beta.11 | 213 | 10/13/2025 |
| 0.9.0-beta.10 | 256 | 9/14/2025 |
| 0.9.0-beta.9 | 203 | 8/26/2025 |
| 0.9.0-beta.8 | 276 | 8/25/2025 |
| 0.9.0-beta.7 | 147 | 8/11/2025 |
| 0.9.0-beta.6 | 268 | 3/27/2025 |
| 0.9.0-beta.5 | 150 | 3/14/2025 |
| 0.9.0-beta.4 | 158 | 3/12/2025 |
| 0.9.0-beta.3 | 98 | 2/25/2025 |
| 0.9.0-beta.1 | 144 | 2/12/2025 |
| 0.8.0-beta.2 | 143 | 7/10/2024 |
| 0.8.0-beta.1 | 238 | 11/27/2023 |
| 0.6.0-beta.11 | 127 | 10/10/2023 |