You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -83,7 +84,7 @@ var logger = new LoggerConfiguration()
83
84
84
85
For .NET Core projects build tools produce `.deps.json` files and this package implements a convention using `Microsoft.Extensions.DependencyModel` to find any package among dependencies with `Serilog` anywhere in the name and pulls configuration methods from it, so the `Using` section in example above can be omitted:
85
86
86
-
```json
87
+
```yaml
87
88
{
88
89
"Serilog": {
89
90
"MinimumLevel": "Debug",
@@ -106,8 +107,9 @@ In case of [non-standard](#azure-functions-v2-v3) dependency management you can
@@ -183,6 +186,22 @@ You can also declare `LoggingLevelSwitch`-es in custom section and reference the
183
186
184
187
Level updates to switches are also respected for a dynamic update.
185
188
189
+
Since version 7.0.0, both declared switches (i.e. `Serilog:LevelSwitches` section) and minimum level override switches (i.e. `Serilog:MinimumLevel:Override` section) are exposed through a callback on the reader options so that a reference can be kept:
These sections support simplified syntax, for example the following is valid if no arguments are needed by the sinks:
@@ -195,7 +214,7 @@ Or alternatively, the long-form (`"Name":` ...) syntax from the example above ca
195
214
196
215
By `Microsoft.Extensions.Configuration.Json` convention, array syntax implicitly defines index for each element in order to make unique paths for configuration keys. So the example above is equivalent to:
197
216
198
-
```json
217
+
```yaml
199
218
"WriteTo": {
200
219
"0": "Console",
201
220
"1": "DiagnosticTrace"
@@ -204,7 +223,7 @@ By `Microsoft.Extensions.Configuration.Json` convention, array syntax implicitly
204
223
205
224
And
206
225
207
-
```json
226
+
```yaml
208
227
"WriteTo:0": "Console",
209
228
"WriteTo:1": "DiagnosticTrace"
210
229
```
@@ -213,7 +232,7 @@ And
213
232
214
233
When overriding settings with [environment variables](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1#environment-variables) it becomes less convenient and fragile, so you can specify custom names:
@@ -226,9 +245,9 @@ This section defines a static list of key-value pairs that will enrich log event
226
245
227
246
### Filter section
228
247
229
-
This section defines filters that will be applied to log events. It is especially usefull in combination with _[Serilog.Expressions](https://github.com/serilog/serilog-expressions)_ (or legacy _[Serilog.Filters.Expressions](https://github.com/serilog/serilog-filters-expressions)_) package so you can write expression in text form:
248
+
This section defines filters that will be applied to log events. It is especially useful in combination with _[Serilog.Expressions](https://github.com/serilog/serilog-expressions)_ (or legacy _[Serilog.Filters.Expressions](https://github.com/serilog/serilog-filters-expressions)_) package so you can write expression in text form:
230
249
231
-
```json
250
+
```yaml
232
251
"Filter": [{
233
252
"Name": "ByIncludingOnly",
234
253
"Args": {
@@ -239,7 +258,7 @@ This section defines filters that will be applied to log events. It is especiall
239
258
240
259
Using this package you can also declare `LoggingFilterSwitch`-es in custom section and reference them for filter parameters:
Some Serilog packages require a reference to a logger configuration object. The sample program in this project illustrates this with the following entry configuring the _[Serilog.Sinks.Async](https://github.com/serilog/serilog-sinks-async)_ package to wrap the _[Serilog.Sinks.File](https://github.com/serilog/serilog-sinks-file)_ package. The `configure` parameter references the File sink configuration:
262
297
263
-
```json
298
+
```yaml
264
299
"WriteTo:Async": {
265
300
"Name": "Async",
266
301
"Args": {
@@ -282,11 +317,13 @@ Some Serilog packages require a reference to a logger configuration object. The
282
317
283
318
When the configuration specifies a discrete value for a parameter (such as a string literal), the package will attempt to convert that value to the target method's declared CLR type of the parameter. Additional explicit handling is provided for parsing strings to `Uri`, `TimeSpan`, `enum`, arrays and custom collections.
284
319
320
+
Since version 7.0.0, conversion will use the invariant culture (`CultureInfo.InvariantCulture`) as long as the `ReadFrom.Configuration(IConfiguration configuration, ConfigurationReaderOptions options)` method is used. Obsolete methods use the current culture to preserve backward compatibility.
321
+
285
322
### Static member support
286
323
287
324
Static member access can be used for passing to the configuration argument via [special](https://github.com/serilog/serilog-settings-configuration/blob/dev/test/Serilog.Settings.Configuration.Tests/StringArgumentValueTests.cs#L35) syntax:
288
325
289
-
```json
326
+
```yaml
290
327
{
291
328
"Args": {
292
329
"encoding": "System.Text.Encoding::UTF8",
@@ -299,14 +336,15 @@ Static member access can be used for passing to the configuration argument via [
299
336
300
337
If the parameter value is not a discrete value, it will try to find a best matching public constructor for the argument:
301
338
302
-
```json
339
+
```yaml
303
340
{
304
341
"Name": "Console",
305
342
"Args": {
306
343
"formatter": {
307
344
// `type` (or $type) is optional, must be specified for abstract declared parameter types
@@ -317,7 +355,7 @@ For other cases the package will use the configuration binding system provided b
317
355
318
356
If parameter type is an interface or an abstract class you need to specify the full type name that implements abstract type. The implementation type should have parameterless constructor.
@@ -405,3 +444,7 @@ In order to make auto-discovery of configuration assemblies work, modify Functio
405
444
406
445
</Project>
407
446
```
447
+
448
+
### Versioning
449
+
450
+
This package tracks the versioning and target framework support of its [_Microsoft.Extensions.Configuration_](https://nuget.org/packages/Microsoft.Extensions.Configuration) dependency.
0 commit comments