Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 438c963

Browse files
authored
Merge pull request #38 from serilog/adamchester-patch-1
Add additional JSON config sample
2 parents 6d3f7ae + ae6c75b commit 438c963

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ var logger = new LoggerConfiguration()
122122
```
123123

124124
In your `appsettings.json` file, under the `Serilog` node, :
125-
126125
```json
127126
{
128127
"Serilog": {
@@ -131,6 +130,23 @@ In your `appsettings.json` file, under the `Serilog` node, :
131130
}
132131
```
133132

133+
To configure the console sink with a different theme and include the `SourceContext` in the output, change your `appsettings.json` to:
134+
```json
135+
{
136+
"Serilog": {
137+
"WriteTo": [
138+
{
139+
"Name": "Console",
140+
"Args": {
141+
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
142+
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
143+
}
144+
}
145+
]
146+
}
147+
}
148+
```
149+
134150
### Upgrading from _Serilog.Sinks.Console_ 2.x
135151

136152
To achieve output identical to version 2 of this sink, specify a formatter and output template explicitly:

0 commit comments

Comments
 (0)