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

The Great Console Unification #7

Closed
4 of 5 tasks
nblumhardt opened this issue May 21, 2017 · 9 comments
Closed
4 of 5 tasks

The Great Console Unification #7

nblumhardt opened this issue May 21, 2017 · 9 comments

Comments

@nblumhardt
Copy link
Member

nblumhardt commented May 21, 2017

From serilog-archive/serilog-sinks-literate#17.

We've now had experience with three different console sink designs, this one, ColoredConsole and LiterateConsole.

Each has strengths and weaknesses; for example, literate has nice presentation, but Console can accept a custom formatter and produce valid JSON if required.

It's time to unify all of these. There are, as always, options. A strawman proposal:

  • Extend this sink (Serilog.Sinks.Console) so that it supports everything we would like it to (as a 3.0/breaking change release)
  • Make Serilog.Sinks.ColoredConsole and Serilog.Sinks.LiterateConsole into thin wrappers around Serilog.Sinks.Console that configure it with default palettes/formatting options to achieve (mostly?) the original output of those sinks
  • Mark WriteTo.LiterateConsole() and WriteTo.ColoredConsole(), and the corresponding NuGet packages, obsolete, directing users to WriteTo.Console()

Things I think we want without doubt:

  • All of the currently-available options in the three existing sinks:
    • Typical formatting options: message template or custom ITextFormatter, culture
    • Standard minimum level configuration
    • Minimum-level-to-STDERR
  • Palette control
    • By default, should look roughly like the current literate console (but we might update the color scheme, e.g. along the lines of VSCode?)
    • By default, uses ANSI color codes and make sure presentation is first-class in cmd.exe, bash (dark) and PowerShell (default blue) terminals
    • Custom ANSI and Windows palette implementations (LiterateConsole and ColoredConsole might use Windows ones by default, but we'd strongly encourage ANSI through docs/examples)
    • Selectable built-in "no color" palette
  • Support for {Properties}
  • Support for {Message:l} (this would probably be in the default template, since color would also be on by default, making property value delimiters (") redundant

Stretch/later goals:

  • Some level palette control via XML/JSON configuration (perhaps just choosing color/no-color, or palette-by-Type)

Other thoughts:

  • Do we want to keep using the default "Serilog-style" rendering of things like dictionaries and StructureValue, or would the output be more predictable/meaningful for people if we instead printed complex values as (syntax-highlighted) JSON?
@adamchester
Copy link
Member

👍

@adamchester
Copy link
Member

Do we want to keep using the default "Serilog-style"

I would be OK with printing highlighted JSON, it's easier to copy/paste/manipulate and more predictable for users I think.

@frg
Copy link

frg commented Jun 14, 2017

Is the release date for these known, yet? Great work on this! :)

@merbla
Copy link
Contributor

merbla commented Jun 14, 2017

@frg sorry, no date as yet. With serilog/serilog#977 merged it opens up other sinks to start some required changes.

@nblumhardt
Copy link
Member Author

Hoping to have some time to push this forward in the next day or two, but it'll be a while until it's ready. There are some non-trivial weaknesses in LiterateConsole that need to be resolved in the unified version :-)

@frg
Copy link

frg commented Jun 15, 2017

@nblumhardt Great news! 👍

@nblumhardt
Copy link
Member Author

On NuGet now in 3.0.0-dev-00732

@nblumhardt
Copy link
Member Author

Any and all testing/validation appreciated, BTW :-)

@Noctis-
Copy link

Noctis- commented Jan 30, 2018

Time flies ...last time i've looked at these V2 was breaking our V1 things ... and here we are ... V3, and we didn't have the time to update :)
Good work 👍

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

No branches or pull requests

5 participants