Serilog.Sinks.PeriodicBatching 4.1.2-dev-00851
Serilog.Sinks.PeriodicBatching
A wrapper for Serilog sinks that asynchronously emits events in batches, useful when logging to a slow and/or remote target.
Getting started
Sinks that, for performance reasons, need to emit events in batches, can be implemented using PeriodicBatchingSink
from this package.
First, install the package into your Sink project:
dotnet add package Serilog.Sinks.PeriodicBatching
Then, instead of implementing Serilog's ILogEventSink
, implement IBatchedLogEventSink
in your sink class:
class ExampleBatchedSink : IBatchedLogEventSink
{
public async Task EmitBatchAsync(IEnumerable<LogEvent> batch)
{
foreach (var logEvent in batch)
Console.WriteLine(logEvent);
}
public Task OnEmptyBatchAsync() { }
}
Finally, in your sink's configuration method, construct a PeriodicBatchingSink
that wraps your batched sink:
public static class LoggerSinkExampleConfiguration
{
public static LoggerConfiguration Example(this LoggerSinkConfiguration loggerSinkConfiguration)
{
var exampleSink = new ExampleBatchedSink();
var batchingOptions = new PeriodicBatchingSinkOptions
{
BatchSizeLimit = 100,
Period = TimeSpan.FromSeconds(2),
EagerlyEmitFirstEvent = true,
QueueLimit = 10000
};
var batchingSink = new PeriodicBatchingSink(exampleSink, batchingOptions);
return loggerSinkConfiguration.Sink(batchingSink);
}
}
Showing the top 20 packages that depend on Serilog.Sinks.PeriodicBatching.
Packages | Downloads |
---|---|
Microsoft.Extensions.Logging.AzureAppServices
Logger implementation to support Azure App Services 'Diagnostics logs' and 'Log stream' features.
|
6 |
Microsoft.Extensions.Logging.AzureAppServices
Logger implementation to support Azure App Services 'Diagnostics logs' and 'Log stream' features.
|
5 |
Microsoft.Extensions.Logging.AzureAppServices
Diagnostics logger for Azure WebApps
|
5 |
Microsoft.Extensions.Logging.AzureAppServices
Logger implementation to support Azure App Services 'Diagnostics logs' and 'Log stream' features.
|
4 |
Microsoft.Extensions.Logging.AzureAppServices
Logger implementation to support Azure App Services 'Diagnostics logs' and 'Log stream' features.
|
3 |
.NET Framework 4.6.2
- Serilog (>= 3.1.1)
- System.Threading.Channels (>= 8.0.0)
.NET 6.0
- Serilog (>= 3.1.1)
.NET Standard 2.0
- Serilog (>= 3.1.1)
- System.Threading.Channels (>= 8.0.0)
Version | Downloads | Last updated |
---|---|---|
5.0.1-dev-00860 | 8 | 07/03/2024 |
5.0.0 | 2 | 06/22/2024 |
5.0.0-dev-00855 | 2 | 06/24/2024 |
4.1.2-dev-00851 | 2 | 06/24/2024 |
4.1.1 | 2 | 06/24/2024 |
4.1.1-dev-00845 | 4 | 05/27/2024 |
4.1.0 | 3 | 05/27/2024 |
4.1.0-dev-00840 | 3 | 05/25/2024 |
4.0.2-dev-00838 | 3 | 05/25/2024 |
4.0.1 | 5 | 04/28/2024 |
4.0.1-dev-00832 | 8 | 03/28/2024 |
4.0.0 | 5 | 04/26/2024 |
4.0.0-dev-00824 | 5 | 04/11/2024 |
4.0.0-dev-00821 | 4 | 04/25/2024 |
3.1.1-dev-00804 | 5 | 04/25/2024 |
3.1.1-dev-00801 | 4 | 04/25/2024 |
3.1.0 | 4 | 04/26/2024 |
3.1.0-dev-00796 | 4 | 04/25/2024 |
3.0.0 | 4 | 04/26/2024 |
3.0.0-dev-00792 | 4 | 04/25/2024 |
2.3.1 | 6 | 04/26/2024 |
2.3.1-dev-00785 | 4 | 04/25/2024 |
2.3.1-dev-00780 | 5 | 04/25/2024 |
2.3.1-dev-00776 | 5 | 04/25/2024 |
2.3.1-dev-00774 | 5 | 04/25/2024 |
2.3.0 | 4 | 04/26/2024 |
2.3.0-dev-00765 | 6 | 04/05/2024 |
2.3.0-dev-00762 | 4 | 04/25/2024 |
2.3.0-dev-00760 | 4 | 04/25/2024 |
2.2.1-dev-00758 | 4 | 04/25/2024 |
2.2.1-dev-00755 | 8 | 04/25/2024 |
2.2.0 | 5 | 04/26/2024 |
2.2.0-dev-00748 | 5 | 04/25/2024 |
2.2.0-dev-00740 | 5 | 04/25/2024 |
2.1.1 | 7 | 04/26/2024 |
2.1.1-dev-00732 | 4 | 04/25/2024 |
2.1.1-dev-00729 | 4 | 04/25/2024 |
2.1.1-dev-00725 | 9 | 04/19/2024 |
2.1.0 | 4 | 04/26/2024 |
2.1.0-dev-00720 | 5 | 03/25/2024 |
2.0.2-dev-00719 | 7 | 05/25/2024 |
2.0.1 | 4 | 04/26/2024 |
2.0.1-dev-00714 | 4 | 04/25/2024 |
2.0.0 | 5 | 04/26/2024 |
2.0.0-rc-707 | 6 | 04/22/2024 |
2.0.0-rc-705 | 5 | 04/26/2024 |
2.0.0-beta-702 | 4 | 04/29/2024 |
2.0.0-beta-700 | 4 | 04/29/2024 |
2.0.0-beta-519 | 6 | 04/29/2024 |
2.0.0-beta-516 | 5 | 04/29/2024 |
2.0.0-beta-513 | 7 | 04/29/2024 |
2.0.0-beta-511 | 5 | 04/29/2024 |
2.0.0-beta-509 | 5 | 04/29/2024 |
2.0.0-beta-507 | 5 | 04/29/2024 |
2.0.0-beta-505 | 5 | 04/29/2024 |
2.0.0-beta-502 | 4 | 04/29/2024 |
2.0.0-beta-499 | 4 | 04/29/2024 |
2.0.0-beta-495 | 4 | 04/29/2024 |
2.0.0-beta-494 | 7 | 04/29/2024 |
2.0.0-beta-493 | 4 | 04/29/2024 |
2.0.0-beta-487 | 8 | 04/29/2024 |
2.0.0-beta-486 | 4 | 04/29/2024 |
2.0.0-beta-479 | 4 | 04/29/2024 |
2.0.0-beta-478 | 6 | 04/17/2024 |
2.0.0-beta-465 | 5 | 04/29/2024 |