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

Support for all line colouring #75

Closed
wants to merge 1 commit into from

Conversation

SixFive7
Copy link

@SixFive7 SixFive7 commented Nov 7, 2019

What issue does this PR address?
#35

Does this PR introduce a breaking change?
Not expected. But please check.

Please check if the PR fulfills these requirements

  • The commit follows our guidelines
  • Unit Tests for the changes have been added (for bug fixes / features)
    Just changes. No extra tests.

Other information:
An example of a possible (if not somewhat ugly) output:
image

I'm unsure of line 26 in ThemedValueFormatterState.cs.

Also, there might be a cleaner way to keep the Events.LogEventLevel.Information statements out of the tests?

Finally I only implemented SystemConsoleThemes.Literate as an example as I have no clue what colouring defaults are appropriate.

@nblumhardt
Copy link
Member

nblumhardt commented Nov 8, 2019

Thanks!

I think all of the threading of the level through the various pieces is solid. I don't think we need to bake the idea of a "line style" into ConsoleTheme directly, though: if we overload Set() to optionally accept a level, then subclass themes could opt in to level-specific line colouring.

E.g. if, in ConsoleTheme we have:

public abstract int Set(TextWriter output, ConsoleThemeStyle style);

public virtual int Set(TextWriter output, ConsoleThemeStyle style, LogEventLevel level)
{
    return Set(output, style);
}

This also avoids changing the signature of the public Set method, since it'd be a breaking change for subclasses.

(It might be one step too far, but with some tricky substitution, we could introduce a new Level member to ConsoleThemeStyle, and only trigger using the level-specific LevelDebug etc. members when falling back to the two-argument Set method.)

Here's what the old theme looked like, just for historical interest :-)

image

@jwillmer
Copy link

When can we expect a merge?

@kyrylomyr
Copy link

It would be great to see this PR live

@nblumhardt
Copy link
Member

Closing this one as stale, but if the OP or anyone following along is keen to follow up - I left some comments originally above; I think in order to merge this we'd also need at least one usable/aesthetically-pleasing example we could point folks to.

@nblumhardt nblumhardt closed this Sep 5, 2022
@Hedgineering
Copy link

Somewhat similar issue but I was trying to color the full line based on log levels;
image

I figured out how to do it. You can find how I accomplished it here if you're interested:
#35 (comment)

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 this pull request may close these issues.

5 participants