Skip to content

Commit 5b02759

Browse files
authored
Merge pull request #32 from caioproiete/add-docs-on-using-enums
Document how to set values from enumerations [skip ci]
2 parents 2ce17d1 + e3b132f commit 5b02759

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,15 @@ and in XML
128128
### Filtering
129129

130130
Filters can be specified using the _Serilog.Filters.Expressions_ package; see the [README](https://github.com/serilog/serilog-filters-expressions) there for more information.
131+
132+
### Setting values from enumerations
133+
134+
When configuring sink settings with values from enumerations, use the member name, without specifying the name of the enumeration.
135+
136+
For example, to configure the `RollingInterval` of the [File Sink](https://github.com/serilog/serilog-sinks-file) to create a new log file per day, use `Day` instead of `RollingInterval.Day`:
137+
138+
```xml
139+
<add key="serilog:write-to:File.rollingInterval" value="Day"/>
140+
```
141+
142+
If you specify the the name of the enumeration, you'll receive an error similar to `System.ArgumentException: Requested value 'RollingInterval.Day' was not found`

0 commit comments

Comments
 (0)