Support non-default configuration with Serilog.Settings.Configuration #828
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This feature was suggested/requested in closed issues #58 and #300. I too like to configure Serilog using appsettings.json, and this pull request is based on the implementation I currently use. This pull requests adds an overload of
WithExceptionDetails
that builds aDestructuringOptionsBuilder
based on the provided arguments.I did not write test cases for this, since I could not come up with an easy way to do this.
The following example adds a single destructurer on top of the default ones.
The following example adds an extra property filter. Note that this does not work at the moment, because Serilog.Settings.Configuration has problems with arrays inside constructor arguments. I already created a pull request for that at serilog/serilog-settings-configuration#405. When using the changes from that pull request the following will work.
The following example specifies the default configuration explicitly. This is not very useful, except that it shows what all configuration options are.