Skip to content

Commit

Permalink
serilog#17 README.md updates.
Browse files Browse the repository at this point in the history
Added instructions for chaining debug level call.
Also the same for the XML and JSON config.
  • Loading branch information
Reeceeboii committed Aug 18, 2024
1 parent 4bff92c commit cfbe437
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Then enable the sink using `WriteTo.Debug()`:
```csharp
Log.Logger = new LoggerConfiguration()
.WriteTo.Debug()
.MinimumLevel.Debug()
.CreateLogger();

Log.Information("Hello, world!");
Expand All @@ -24,6 +25,10 @@ Log events will be printed to the debug output:

![Debug Output](https://raw.githubusercontent.com/serilog/serilog-sinks-debug/dev/assets/Screenshot.png)

The chaining of the `MinimumLevel.Debug()` call is required in order to log events of level `LogEventLevel.Debug`, as the default minimum level for a new `LoggerConfiguration` is `LogEventLevel.Information`.

Note that if the chaining of this call is omitted, only events of `LogEventLevel.Information` and above will be logged.

### XML `<appSettings>` configuration

To use the sink with the [Serilog.Settings.AppSettings](https://github.com/serilog/serilog-settings-appsettings) package, first install that package if you haven't already done so:
Expand All @@ -47,6 +52,7 @@ In your application's `App.config` or `Web.config` file, specify the console sin
<appSettings>
<add key="serilog:using:Debug" value="Serilog.Sinks.Debug" />
<add key="serilog:write-to:Debug" />
<add key="serilog:minimum-level" value="Debug" />
```

### JSON `appsettings.json` configuration
Expand Down Expand Up @@ -74,7 +80,8 @@ In your `appsettings.json` file, under the `Serilog` node, :
```json
{
"Serilog": {
"WriteTo": ["Debug"]
"WriteTo": ["Debug"],
"MinimumLevel": "Debug"
}
}
```
Expand Down

0 comments on commit cfbe437

Please sign in to comment.