serilog / serilog-settings-configuration

A Serilog configuration provider that reads from Microsoft.Extensions.Configuration
Apache License 2.0
444 stars 129 forks source link

MinimumLevel Override configuration section case-sensitivity #386

Closed GuillaumeBau closed 1 year ago

GuillaumeBau commented 1 year ago

Hello,

In the section MinimumLevel:Override, the log level detection are case-sensitive :

https://github.com/serilog/serilog-settings-configuration/blob/e8783352aff2f46b52d41c4232621c9d4b9ee2d7/src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationReader.cs#L167C13-L167C76

In contrario, the log level parsing do by the function ParseLogEventLevel is case-insensitive :

https://github.com/serilog/serilog-settings-configuration/blob/d7e0dbd7239df3b230a0dd330fefbe19bb6818bf/src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationReader.cs#L595C9-L595C84

Could you render the log level detection do in ApplyMinimumLevel case-insensitive ? This will prevent the following error occuring :

System.InvalidOperationException: 'No LoggingLevelSwitch has been declared with name "verbose". You might be missing a section "LevelSwitches":{"verbose":"InitialLevel"}'

Thanks