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

Custom format/culture for report output values (for CSV, and maybe HTML, MD) #1295

Closed
Konard opened this issue Oct 26, 2019 · 1 comment · Fixed by #1302
Closed

Custom format/culture for report output values (for CSV, and maybe HTML, MD) #1295

Konard opened this issue Oct 26, 2019 · 1 comment · Fixed by #1302
Milestone

Comments

@Konard
Copy link

Konard commented Oct 26, 2019

At the moment in CSV, HTML, and MD version of reports I get the time in the formated like 6,114.79 ns.
But each time I have to convert it into 6114,79 manually for my local culture (ru-RU) to be able to use these values for building the diagrams in both Google Docs and Microsoft Excel.
Without the conversion, these programs refuse to understand the values.
Related to #1100.

So is there a way to reformat these values from code? And if none can you add one?

AndreyAkinshin added a commit that referenced this issue Dec 5, 2019
The goal of these refactoring is to unify some of our API and respect the given value of CultureInfo.
The implementation is still not perfect, but it's an important first step.
Highlights:

* Unify ToString APIs
  All of the ToStr(), ToTimeStr(), ToSizeStr() methods were removed.
  Initially, they were introduced as hacked shortcuts to formatting purposes, but today they become misleading in some cases.
  Instead of them, now we always should use ToString().
  Where it makes sense, the proper overloads like ToString(CultureInfo, format) are available.
* Introduce CultureInfo property in Config
  Now it's possible to set the CultureInfo, the given value will be used everywhere including exporters (Fix #1295)
* Remove MultiEncodingString and Encodings in Configs
  The original goal of these classes was providing a way to enable Unicode support in exporter (see #487 for details).
  Unfortunately, it made many APIs overcomplicated because we had to pass Encoding everywhere.
  If we think carefully, we will understand that the only problem that we actually have relates to the terminal that doesn't support Unicode
    (in other places, we can use Unicode symbols without any problems).
  I decided to delete the MultiEncodingString class, use Unicode symbols by default, and patch them only in ConsoleLogger
    (see AsciiHelper for details).
  Now, users can turn on Unicode support in console output via [UnicodeConsoleLogger]
    (see IntroUnicode for details).
  All other exporters are always able to use Unicode.
  Some of them may patch Unicode symbols to achieve better portability (e.g., see HtmlExporter.HtmlLoggerWrapper.Escape)
* Introduce ILogger.Id and ILogger.Priority
  These APIs allow overriding existing loggers by custom.
  For each Id, only the logger with the highest priority will be chosen.
  With the help of this feature, we can override ConsoleLogger.Ascii with ConsoleLogger.Unicode
* Introduce SizeValue
  This structure is a wrapper for a long value that helps to operate with size values (bytes, kilobytes, etc.)
* Rename TimeInterval->TimeValue
  The original name was confusing because an interval typically has start and end.
  In our situation, it similar to TimeSpan but has its own features and use cases.
  I decided to rename it to TimeValue (to make consistent with SizeValue).
* Introduce CultureInfo.GetActualListSeparator()
  TextInfo.ListSeparator shouldn't be used anymore because it returns incorrect value on .NET Core+Unix
    (see dotnet/runtime#536 for details)
AndreyAkinshin added a commit that referenced this issue Dec 5, 2019
The goal of these refactoring is to unify some of our API and respect the given value of CultureInfo.
The implementation is still not perfect, but it's an important first step.
Highlights:

* Unify ToString APIs
  All of the ToStr(), ToTimeStr(), ToSizeStr() methods were removed.
  Initially, they were introduced as hacked shortcuts to formatting purposes, but today they become misleading in some cases.
  Instead of them, now we always should use ToString().
  Where it makes sense, the proper overloads like ToString(CultureInfo, format) are available.
* Introduce CultureInfo property in Config
  Now it's possible to set the CultureInfo, the given value will be used everywhere including exporters (Fix #1295)
* Remove MultiEncodingString and Encodings in Configs
  The original goal of these classes was providing a way to enable Unicode support in exporter (see #487 for details).
  Unfortunately, it made many APIs overcomplicated because we had to pass Encoding everywhere.
  If we think carefully, we will understand that the only problem that we actually have relates to the terminal that doesn't support Unicode
    (in other places, we can use Unicode symbols without any problems).
  I decided to delete the MultiEncodingString class, use Unicode symbols by default, and patch them only in ConsoleLogger
    (see AsciiHelper for details).
  Now, users can turn on Unicode support in console output via [UnicodeConsoleLogger]
    (see IntroUnicode for details).
  All other exporters are always able to use Unicode.
  Some of them may patch Unicode symbols to achieve better portability (e.g., see HtmlExporter.HtmlLoggerWrapper.Escape)
* Introduce ILogger.Id and ILogger.Priority
  These APIs allow overriding existing loggers by custom.
  For each Id, only the logger with the highest priority will be chosen.
  With the help of this feature, we can override ConsoleLogger.Ascii with ConsoleLogger.Unicode
* Introduce SizeValue
  This structure is a wrapper for a long value that helps to operate with size values (bytes, kilobytes, etc.)
* Rename TimeInterval->TimeValue
  The original name was confusing because an interval typically has start and end.
  In our situation, it similar to TimeSpan but has its own features and use cases.
  I decided to rename it to TimeValue (to make consistent with SizeValue).
* Introduce CultureInfo.GetActualListSeparator()
  TextInfo.ListSeparator shouldn't be used anymore because it returns incorrect value on .NET Core+Unix
    (see dotnet/runtime#536 for details)
AndreyAkinshin added a commit that referenced this issue Dec 5, 2019
The goal of these refactoring is to unify some of our API and respect the given value of CultureInfo.
The implementation is still not perfect, but it's an important first step.
Highlights:

* Unify ToString APIs
  All of the ToStr(), ToTimeStr(), ToSizeStr() methods were removed.
  Initially, they were introduced as hacked shortcuts to formatting purposes, but today they become misleading in some cases.
  Instead of them, now we always should use ToString().
  Where it makes sense, the proper overloads like ToString(CultureInfo, format) are available.
* Introduce CultureInfo property in Config
  Now it's possible to set the CultureInfo, the given value will be used everywhere including exporters (Fix #1295)
* Remove MultiEncodingString and Encodings in Configs
  The original goal of these classes was providing a way to enable Unicode support in exporter (see #487 for details).
  Unfortunately, it made many APIs overcomplicated because we had to pass Encoding everywhere.
  If we think carefully, we will understand that the only problem that we actually have relates to the terminal that doesn't support Unicode
    (in other places, we can use Unicode symbols without any problems).
  I decided to delete the MultiEncodingString class, use Unicode symbols by default, and patch them only in ConsoleLogger
    (see AsciiHelper for details).
  Now, users can turn on Unicode support in console output via [UnicodeConsoleLogger]
    (see IntroUnicode for details).
  All other exporters are always able to use Unicode.
  Some of them may patch Unicode symbols to achieve better portability (e.g., see HtmlExporter.HtmlLoggerWrapper.Escape)
* Introduce ILogger.Id and ILogger.Priority
  These APIs allow overriding existing loggers by custom.
  For each Id, only the logger with the highest priority will be chosen.
  With the help of this feature, we can override ConsoleLogger.Ascii with ConsoleLogger.Unicode
* Introduce SizeValue
  This structure is a wrapper for a long value that helps to operate with size values (bytes, kilobytes, etc.)
* Rename TimeInterval->TimeValue
  The original name was confusing because an interval typically has start and end.
  In our situation, it similar to TimeSpan but has its own features and use cases.
  I decided to rename it to TimeValue (to make consistent with SizeValue).
* Introduce CultureInfo.GetActualListSeparator()
  TextInfo.ListSeparator shouldn't be used anymore because it returns incorrect value on .NET Core+Unix
    (see dotnet/runtime#536 for details)
adamsitnik pushed a commit that referenced this issue Dec 12, 2019
* CultureInfo Refactoring

The goal of these refactoring is to unify some of our API and respect the given value of CultureInfo.
The implementation is still not perfect, but it's an important first step.
Highlights:

* Unify ToString APIs
  All of the ToStr(), ToTimeStr(), ToSizeStr() methods were removed.
  Initially, they were introduced as hacked shortcuts to formatting purposes, but today they become misleading in some cases.
  Instead of them, now we always should use ToString().
  Where it makes sense, the proper overloads like ToString(CultureInfo, format) are available.
* Introduce CultureInfo property in Config
  Now it's possible to set the CultureInfo, the given value will be used everywhere including exporters (Fix #1295)
* Remove MultiEncodingString and Encodings in Configs
  The original goal of these classes was providing a way to enable Unicode support in exporter (see #487 for details).
  Unfortunately, it made many APIs overcomplicated because we had to pass Encoding everywhere.
  If we think carefully, we will understand that the only problem that we actually have relates to the terminal that doesn't support Unicode
    (in other places, we can use Unicode symbols without any problems).
  I decided to delete the MultiEncodingString class, use Unicode symbols by default, and patch them only in ConsoleLogger
    (see AsciiHelper for details).
  Now, users can turn on Unicode support in console output via [UnicodeConsoleLogger]
    (see IntroUnicode for details).
  All other exporters are always able to use Unicode.
  Some of them may patch Unicode symbols to achieve better portability (e.g., see HtmlExporter.HtmlLoggerWrapper.Escape)
* Introduce ILogger.Id and ILogger.Priority
  These APIs allow overriding existing loggers by custom.
  For each Id, only the logger with the highest priority will be chosen.
  With the help of this feature, we can override ConsoleLogger.Ascii with ConsoleLogger.Unicode
* Introduce SizeValue
  This structure is a wrapper for a long value that helps to operate with size values (bytes, kilobytes, etc.)
* Introduce CultureInfo.GetActualListSeparator()
  TextInfo.ListSeparator shouldn't be used anymore because it returns incorrect value on .NET Core+Unix
    (see dotnet/runtime#536 for details)

* Improve EncodingAttribute

* Improve PlainExporter

* Improve TostResult

* Improve AsciiHelper
@AndreyAkinshin AndreyAkinshin added this to the v0.12.1 milestone Dec 12, 2019
@Konard
Copy link
Author

Konard commented Dec 13, 2019

Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants