Skip to content

Commit a890820

Browse files
authored
#10 README updates [Skip CI]
1 parent 050f808 commit a890820

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# Serilog.Sinks.Async [![Build status](https://ci.appveyor.com/api/projects/status/ewlh5x6xl4se5ech?svg=true)](https://ci.appveyor.com/project/JezzSantos/serilog-sinks-async)
2-
An async Serilog sink
1+
# Serilog.Sinks.Async [![Build status](https://ci.appveyor.com/api/projects/status/gvk0wl7aows14spn?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-async) [![NuGet](https://img.shields.io/nuget/vpre/Serilog.Sinks.Async.svg?maxAge=2592000)](https://www.nuget.org/packages/Serilog.Sinks.Async)
32

4-
Use this buffered, async, delegating, sink to reduce the time it takes for your app to write your log events to your sinks. This sink can work with any `IEventLogSink` you use.
3+
Use this buffered, async, delegating, sink to reduce the time it takes for your app to write your log events to your sinks. This sink can work with any `ILogEventSink` you use.
54

6-
Especially suited to sinks that are either slow to write or have I/O bottlenecks (like http, databases, file writes etc.).
7-
This sink uses a separate thread pool thread to write to your sink, freeing up the calling thread to run in your app without having to wait.
5+
Especially suited to non-batching sinks that are either slow to write or have I/O bottlenecks (like http, databases, file writes etc.).
86

9-
Utilizes the producer/consumer pattern (using the TPL `BufferBlock<T>` class), where the calling thread produces log events (on your main thread), and the consumer runs on a thread pool thread consuming log events and writing them to your sink.
7+
This sink uses a separate worker thread to write to your sink, freeing up the calling thread to run in your app without having to wait.
108

119
Install from NuGet:
1210

@@ -18,23 +16,22 @@ Add this sink to your pipeline:
1816

1917
```csharp
2018
Log.Logger = new LoggerConfiguration()
21-
.WriteTo.Async(x => x.Sink(new YourSink()))
19+
.WriteTo.Async(x => x.YourSink())
2220
// Other logger configuration
2321
.CreateLogger()
2422
```
2523

26-
Now `YourSink` will write messages using another [thread pool] thread while your logging thread gets on with more important stuff.
24+
Now `YourSink` will write messages using a worker thread while your applicatoin thread gets on with more important stuff.
2725

28-
If you think your code is producing log events faster than your sink can consume and write them, then the buffer is going to grow in memory, until you run out!
29-
Set a maximum size of the buffer so that your memory is not filled up.
30-
Buffered log events are then (async) postponed in your app thread until your sink catches up.
26+
The default memory buffer feeding the worker thread is capped to 10,000 items, after which arriving events will be dropped. To increase or decrease this limit, specify it when configuring the async sink.
3127

3228
```csharp
3329
Log.Logger = new LoggerConfiguration()
34-
.WriteTo.Async(x => x.Sink(new YourSink), 500) //Max number of logevents to buffer in memory
30+
.WriteTo.Async(x => x.YourSink(), 500) // Max number of events to buffer in memory
3531
// Other logger configurationg
3632
.CreateLogger()
3733
```
3834

39-
## About this Sink
40-
This sink was created by this conversation thread: https://github.com/serilog/serilog/issues/809
35+
## About this sink
36+
37+
This sink was created following this conversation thread: https://github.com/serilog/serilog/issues/809

0 commit comments

Comments
 (0)