Serilog.Sinks.PeriodicBatching 4.0.0-dev-00821
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 |
---|---|
Serilog.Sinks.NewRelic.Logs
A Serilog sink that writes events to NewRelic Logs API.
|
9 |
Serilog.Sinks.NewRelic.Logs
A Serilog sink that writes events to NewRelic Logs API.
|
12 |
Serilog.Sinks.Seq
A Serilog sink that writes events to Seq using newline-delimited JSON and HTTP/HTTPS.
|
8 |
Serilog.Sinks.Seq
A Serilog sink that writes events to Seq using newline-delimited JSON and HTTP/HTTPS.
|
9 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq event server over HTTP/S.
|
8 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/HTTPS.
|
8 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/HTTPS.
|
9 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/HTTPS.
|
10 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/HTTPS.
|
11 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/HTTPS.
|
28 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/S.
|
8 |
Serilog.Sinks.Seq
Serilog sink that writes to the Seq log server over HTTP/S.
|
9 |
.NET Framework 4.6.2
- Serilog (>= 3.1.1)
- System.Threading.Channels (>= 8.0.0)
.NET 6.0
- Serilog (>= 3.1.1)
- System.Threading.Channels (>= 8.0.0)
.NET Standard 2.0
- Serilog (>= 3.1.1)
- System.Threading.Channels (>= 8.0.0)
Version | Downloads | Last updated |
---|---|---|
5.0.1-dev-00860 | 0 | 02.07.2024 |
5.0.0 | 8 | 01.12.2024 |
5.0.0-dev-00855 | 3 | 22.09.2024 |
4.1.2-dev-00851 | 2 | 29.11.2024 |
4.1.1 | 7 | 22.09.2024 |
4.1.1-dev-00845 | 0 | 22.05.2024 |
4.1.0 | 0 | 03.05.2024 |
4.1.0-dev-00840 | 0 | 01.05.2024 |
4.0.2-dev-00838 | 8 | 22.09.2024 |
4.0.1 | 16 | 18.04.2024 |
4.0.1-dev-00832 | 0 | 14.03.2024 |
4.0.0 | 0 | 22.02.2024 |
4.0.0-dev-00824 | 3 | 27.11.2024 |
4.0.0-dev-00821 | 6 | 22.09.2024 |
3.1.1-dev-00804 | 5 | 10.12.2024 |
3.1.1-dev-00801 | 7 | 22.09.2024 |
3.1.0 | 18 | 15.02.2024 |
3.1.0-dev-00796 | 5 | 22.09.2024 |
3.0.0 | 0 | 13.09.2022 |
3.0.0-dev-00792 | 4 | 01.12.2024 |
2.3.1 | 8 | 21.03.2024 |
2.3.1-dev-00785 | 5 | 22.09.2024 |
2.3.1-dev-00780 | 4 | 22.09.2024 |
2.3.1-dev-00776 | 3 | 28.11.2024 |
2.3.1-dev-00774 | 5 | 29.11.2024 |
2.3.0 | 13 | 15.02.2024 |
2.3.0-dev-00765 | 0 | 17.02.2020 |
2.3.0-dev-00762 | 5 | 22.09.2024 |
2.3.0-dev-00760 | 5 | 25.11.2024 |
2.2.1-dev-00758 | 5 | 22.09.2024 |
2.2.1-dev-00755 | 3 | 29.11.2024 |
2.2.0 | 17 | 15.02.2024 |
2.2.0-dev-00748 | 0 | 02.05.2019 |
2.2.0-dev-00740 | 1 | 06.12.2024 |
2.1.1 | 12 | 15.02.2024 |
2.1.1-dev-00732 | 7 | 22.09.2024 |
2.1.1-dev-00729 | 4 | 02.12.2024 |
2.1.1-dev-00725 | 6 | 22.09.2024 |
2.1.0 | 4 | 22.09.2024 |
2.1.0-dev-00720 | 6 | 22.09.2024 |
2.0.2-dev-00719 | 0 | 28.09.2016 |
2.0.1 | 3 | 19.12.2024 |
2.0.1-dev-00714 | 3 | 18.11.2024 |
2.0.0 | 0 | 27.06.2016 |
2.0.0-rc-707 | 0 | 17.05.2016 |
2.0.0-rc-705 | 0 | 17.05.2016 |
2.0.0-beta-702 | 0 | 20.04.2016 |
2.0.0-beta-700 | 5 | 22.09.2024 |
2.0.0-beta-519 | 3 | 15.12.2024 |
2.0.0-beta-516 | 3 | 22.09.2024 |
2.0.0-beta-513 | 4 | 30.10.2024 |
2.0.0-beta-511 | 7 | 22.09.2024 |
2.0.0-beta-509 | 5 | 22.09.2024 |
2.0.0-beta-507 | 4 | 22.09.2024 |
2.0.0-beta-505 | 4 | 22.09.2024 |
2.0.0-beta-502 | 5 | 11.12.2024 |
2.0.0-beta-499 | 8 | 22.09.2024 |
2.0.0-beta-495 | 6 | 22.09.2024 |
2.0.0-beta-494 | 0 | 18.02.2016 |
2.0.0-beta-493 | 3 | 27.11.2024 |
2.0.0-beta-487 | 5 | 22.09.2024 |
2.0.0-beta-486 | 0 | 11.02.2016 |
2.0.0-beta-479 | 0 | 09.02.2016 |
2.0.0-beta-478 | 7 | 22.09.2024 |
2.0.0-beta-465 | 6 | 22.09.2024 |