Skip to content

Commit 7b72dc8

Browse files
Example completed
Readme added & example fixed to reflect out of the box usage.
1 parent 71e875f commit 7b72dc8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ Log.Logger = new LoggerConfiguration()
2222
```
2323

2424
Many sinks simply include all properties without further action required, so the thread id will be logged automatically.
25-
However, some sinks, such as the File and Console sinks use an output template and the new ThreadId may not be automatically output in your sink. In this case, in order for the ThreadId to show up in the logging, you will need to create or modify your output template.
25+
However, some sinks, such as the File and Console sinks use an output template and the new ThreadId may not be automatically output in your sink. In this case, in order for the ThreadId or ThreadName to show up in the logging, you will need to create or modify your output template.
2626

2727
```csharp
2828
w.File(...., outputTemplate:
2929
"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj} {Properties}{NewLine}{Exception}")
3030
```
31-
Here, {Properties} can include not only ThreadId, but any other enrichment which is applied. Alternatively, {ThreadId} could be used instead, if you want to only add the thread id enrichment or {ThreadName}, if you want to only add the thread name enrichment.
31+
Here, {Properties} can include not only ThreadId and ThreadName, but any other enrichment which is applied. Alternatively, {ThreadId} could be used instead, if you want to only add the thread id enrichment and {ThreadName}, if you want to only add the thread name enrichment.
3232

3333
An example, which also uses the Serilogs.Sinks.Async Nuget package, is below:
3434

3535
```csharp
36+
Thread.CurrentThread.Name = "MyWorker";
37+
3638
var logger = Log.Logger = new LoggerConfiguration()
3739
.MinimumLevel.Debug()
3840
.WriteTo.Console(restrictedToMinimumLevel:Serilog.Events.LogEventLevel.Information)

0 commit comments

Comments
 (0)