Skip to content

Commit 792e723

Browse files
authored
Tweaked some wording in the Log Scope notes, per review
1 parent a7c57d1 commit 792e723

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ using (_logger.BeginScope("TransactionId: {TransactionId}, ResponseJson: {Respon
121121

122122
Not only does this add the unnecessary `Scope` property to your event, but it also duplicates serialized values between `Scope` and the intended properties, as you can see here with `ResponseJson`. If this were "real" JSON like an API response, then a potentially very large block of text would be duplicated within your log event! Moreover, the template string within `BeginScope` is rather arbitrary when all you want to do is add a bag of properties, and you start mixing enriching concerns with formatting concerns.
123123

124-
A far better alternative is to use the `BeginScope<TState>(TState state)` method. If you provide any `IEnumerable<KeyValuePair<string, object>>` to this method, then we will output the key/value pairs as structured properties _without_ the `Scope` property, as in this example:
124+
A far better alternative is to use the `BeginScope<TState>(TState state)` method. If you provide any `IEnumerable<KeyValuePair<string, object>>` to this method, then Serilog will output the key/value pairs as structured properties _without_ the `Scope` property, as in this example:
125125

126126
```cs
127127
var scopeProps = new Dictionary<string, object> {

0 commit comments

Comments
 (0)