forked from serilog/serilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for LevelSwith in KeyValuePairSettings (serilog#1020)
* add support for declaring a named LoggingLevelSwitch key="level-switch:foo" value="Information" will create an instance of LoggingLevelSwitch named foo with initial level Information * add support for using a previously declared LoggingLevelSwitch to control MinimumLevel key="minimum-level:controlled-by" value="foo" will set MinimumLevel.ControlledBy with the previously declared named level-switch * [WIP] unit test for passing controlLevelSwitch to a sink * [Refactoring] extracted methods to make it clearer KeyValuePairSettings.ParseVariableDeclarationDirectives and KeyValuePairSettings.LookUpVariable * add the possibility to pass a declared LoggingLevelSwitch to a sink Passing a parameter directive the name of a declared Switch will pass it to the configuration method * add support for level-switch:Switch1 - value = "" and interpret it as level=information * Minor edits/typos in the unit tests * Change brittle tests in order not to rely on reflection to acces brittle private field * Simplify the code around "creating a new LoggingLevelSwitch" + throw a "nicer" error message when referencing an undeclared LoggingLevelSwitch * Add support for referencing a LoggingLevelSwitch from a minimul level override key="serilog:minimum-level:override:System" value ="switchName" will bind the override to a switch that may be controlled through the sink * Enforce declaration of switch as level-switch:$switchName ... and use $ also when referencing the declared swith This helps disambiguate between a variable and the minimum level for a switch ... and makes sure noone is goind to declared a switch with name "Information" * Minor tweaks after review * Explicitly throw a helpful FormatException when specifiying a level-switch with a switch name not starting with a $ sign * Minor refactoring of ParseNamedLevelSwitchDeclarationDirectives use Dictionary.Add() instead of Dictionary[] to make it mor explicit that uniqueness is implied * Refactoring : use TryGetValue instead of ContainsKey * Refactoring : renamed LookUpSwitchByNameOrThrow to LookUpSwitchByName for consistency
- Loading branch information
1 parent
81a9023
commit 3bb8523
Showing
5 changed files
with
302 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.