Skip to content

Commit 4624e6a

Browse files
authored
Update README [Skip CI]
1 parent 07750e6 commit 4624e6a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@ The formatter is used in conjunction with sinks that accept `ITextFormatter`. Fo
2222

2323
```csharp
2424
Log.Logger = new LoggerConfiguration()
25-
.WriteTo.Sink(new RollingFileSink("./logs/myapp.txt", new CompactJsonFormatter(), null, null))
25+
.WriteTo.RollingFile(new CompactJsonFormatter(), "./logs/myapp.json")
2626
.CreateLogger();
2727
```
2828

29+
To specify the formatter in XML `<appSettings>` provide its assembly-qualified type name:
30+
31+
```xml
32+
<appSettings>
33+
<add key="serilog:write-to:RollingFile.pathFormat" value="./logs/myapp.json" />
34+
<add key="serilog:write-to:RollingFile.formatter"
35+
value="Serilog.Formattting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact" />
36+
```
37+
2938
### Rendered events
3039

3140
`CompactJsonFormatter` will preserve the message template, properties, and formatting information so that the rendered message can be created at a later point. When the

0 commit comments

Comments
 (0)