Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for IFormatProvider used to convert string to other types #348

Merged
merged 1 commit into from
Mar 10, 2023

Commits on Mar 9, 2023

  1. Add support for IFormatProvider used to convert string to other types

    Also introduce a new `ConfigurationReaderOptions` class to avoid `ReadFrom.Configuration()` methods exponential growth when adding new options.
    
    All _older_ `Configuration()` methods go through the newly introduced `Configuration(LoggerSettingsConfiguration, IConfiguration, ConfigurationReaderOptions)` method that takes an `ConfigurationReaderOptions` instance.
    
    Older methods explicitly set the `FormatProvider` option to `null` in order to preserve backward compatibility.
    
    By using the new `Configuration()` method, users opt into the new default of having the invariant culture as the format provider.
    
    Note: the `= null` default value in the `Configuration()` method taking a `DependencyContext` has been removed in order to make sure the CS0121 compilation does not occur:
    
    > [CS0121] The call is ambiguous between the following methods or properties: 'ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration, IConfiguration, DependencyContext)' and 'ConfigurationLoggerConfigurationExtensions.Configuration(LoggerSettingsConfiguration, IConfiguration, ConfigurationReaderOptions)'
    
    Fixes serilog#325
    0xced committed Mar 9, 2023
    Configuration menu
    Copy the full SHA
    fbc5e72 View commit details
    Browse the repository at this point in the history