Buffered sink wrapper for Serilog.
Install from NuGet:
dotnet CLI:
dotnet add package Serilog.Sinks.FingersCrossedPowerShell:
Install-Package Serilog.Sinks.FingersCrossedAssuming you have already installed the target sink, such as the file sink, move the wrapped sink's configuration within
a WriteTo.FingersCrossed() statement:
Log.Logger = new LoggerConfiguration()
.WriteTo.FingersCrossed(a => a.Console())
// Other logger configuration
.CreateLogger()
using (LogBuffer.BeginScope())
Log.Information("This will be dropped");
using (LogBuffer.BeginScope())
{
Log.Information("This will be written to the console");
Log.Error("Because there is an error in the scope");
}
Log.CloseAndFlush();The sink was heavily inspired by PHP's Monolog fingers_crossed handler.