-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
pattern encoder: Set trace to default color, reset formatting after #186
Conversation
@@ -584,14 +584,16 @@ impl FormattedChunk { | |||
} | |||
Level::Warn => w.set_style(Style::new().text(Color::Yellow))?, | |||
Level::Info => w.set_style(Style::new().text(Color::Green))?, | |||
Level::Trace => w.set_style(Style::new().text(Color::Black).intense(true))?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could probably remove the .intense or the branch altogether I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, I'd like to keep the intense so it's more clear it's a logging level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have us in parity with env_logger
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding correctly, the color in env_logger causes issues, at least on my terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait nevermind, it has cyan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, in the source code of env_logger it does set the default color of trace to Cyan, but I just can't get it to print Cyan, but every other color is the same as what's printed. I distinctly remember seeing something very similar to (Color::Black).intense(true) when I originally made the PR and was the reason why I used intense here, but I just can't find it in their source code right now.
I disagree with using |
@Rookie1024 I'd rather trace have no specific color at this point until this is made configurable. I don't think going from no color but intense to blue is a solution to the problem, but it's a valid concern that intense might not be ideal for trace level |
@IceSentry Ah, that's fair. I was worried this was going to remain unconfigurable, which would have made this PR a nightmare for my current use case where I am actually using |
Level::Error | Level::Warn | Level::Info => w.set_style(&Style::new())?, | ||
Level::Error | Level::Warn | Level::Info | Level::Trace => { | ||
w.set_style(&Style::new())? | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we adding trace level here again?
@judemille we're so close! Any update on this? |
I think someone just wanted to add the trace level? Not sure, just this is my best take on making what existed compatible. E: Right, in that second statement, it's to clear the intense set earlier in the file. |
@judemille I think the only thing left is just using the colors in #190 so that it will match env_logger |
@judemille what envlogger sets: match level {
Level::Trace => level_style.set_color(Color::Cyan),
Level::Debug => level_style.set_color(Color::Blue),
Level::Info => level_style.set_color(Color::Green),
Level::Warn => level_style.set_color(Color::Yellow),
Level::Error => level_style.set_color(Color::Red).set_bold(true),
}; E: I think just fixing trace is good actually |
* Expose errors as failure::Error (#138) * Issue #129: Drop XML Config support (#137) * Rename file feature (#147) * Rename to config_parsing * Add workflows for devel * Update changelog * Add an init function which takes a RawConfig (#150) * Clippy * Changelog, cleanup * json macro * qualify * typo * Remove unused dir from .gitignore * Init raw on all platforms * Remove log4rs::FormatError::XmlFeatureFlagRequired (#156) * Expand env vars in the path for File and RollingFile appenders (#155) * Reorganize config (#157) * Reorganize config * allow missing docs so tests run * lint abatement * some renames * Use anyhow/thiserror (#159) * Use anyhow/thiserror * Change addtivity to additive to match the actual code (#163) * Errors 1.0 (#160) Co-authored-by: shmapdy <richard.meester@gmail.com> * clippy * Standard derives rebase (#175) * Bump serde-value * Alpha 1 version * Update highlight colors to be the same as env_logger (#167) * Custom err handler (#183) * WIP custom err handling * Compiling * Add an method to the public api * re-enable Debug * bump ver * fix: init_raw_config forcing max_log_level to Info (#200) Co-authored-by: braindead <braindeaded@protonmail.com> * pattern encoder: Set trace to default color, reset formatting after (#186) * pattern encoder: Set trace to default color, reset formatting after * Fix formatting of last commit * lol apparently rustfmt doesn't like commas? idk if this will work * Set trace color to cyan Co-authored-by: Richard M <gadunga@users.noreply.github.com> Co-authored-by: shmapdy <richard.meester@gmail.com> Co-authored-by: Charles Giguere <IceSentry@users.noreply.github.com> Co-authored-by: 1c7718e7 <shirokovMartin@gmail.com> Co-authored-by: braindead <braindeaded@protonmail.com> Co-authored-by: Julia DeMille <8127111+judemille@users.noreply.github.com>
Fixes #184, makes text readable no matter the color scheme.