Configuration with decimal-point numbers
See original GitHub issueWhen reading configuration for sinks that include decimal-point numbers, the configuration reads the value as a string and then parses it using whatever number format the current culture supports.
Example of configuring Sentry as a sink, where SampleRate should be set to 10%::
{
"Name": "Sentry",
"Args": {
"Dsn": "https://<some value>.ingest.sentry.io/<some value>",
"MinimumEventLevel": "Warning",
"Environment": "Prod",
"Release": "<some value>",
"SampleRate": 0.1
}
}
The value is read / parsed as a string here:
argumentValue = new StringArgumentValue(argumentSection.Value);
While applying the configuration the rSampleRate value then depends on whether the current context supports point or comma as decimal point, giving either 0.1 (10%) or 1 (100%) as result.
The desired behavior would be for the number value to be parsed as a number and not a string, when the value is supplied as a number.
Package versions used:
- Serilog: 2.10.0
- Serilog.Settings.Configuration: 3.3.0
- Sentry.Serilog: 3.17.1
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Use decimal tabs to line up numbers with decimal points
When you work with numbers, setting a decimal tab makes numbers, such as amounts of currency, align correctly in a column. ... Click...
Read more >Configuring decimal places for fields with Numbers
Configuring fields to allow for decimal places Set the Decimal Places dropdown to the desired number and then save and publish your form...
Read more >Number helper with decimals - Configuration
So trying to keep things kleen this time I found the helper UI and creaed a helper number BUT cant get it to...
Read more >Configure Windows to Use Commas in Decimal Numbers
For example, some regions use a comma (,) as a decimal separator rather than a decimal point (.). ProntoForms supports different characters as ......
Read more >How to Add Decimal Places in Excel (Automatically)
Automatically Add Decimal Point to Numbers While Typing · Click the File tab · Click on Options · In the Excel Options dialog...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If we are talking about break binary compatibility, then I propose to group the entire set of additional parameters in the settings class. This will allow to protect code from further breaking changes when adding new settings in the future:
So only one method exists, no combinations now and in the future, no breaking changes also (in ideal).
Adding an optional
CultureInfo
toReadFrom.Configuration()
sounds like a good solution.