Upgrade env_logger
to v0.11 (#15278)
This PR upgrades `env_logger` to v0.11.
There were some breaking changes in the style API. I followed the
[migration
guide](73bb418802/CHANGELOG.md (migration-guide)
)
to update the usage.
Visually there shouldn't be any changes:
### Before
<img width="1068" alt="Screenshot 2024-07-26 at 10 20 07 AM"
src="https://github.com/user-attachments/assets/9abdbba2-5a34-46df-a62b-3d6c2d9d1137">
### After
<img width="1061" alt="Screenshot 2024-07-26 at 10 37 35 AM"
src="https://github.com/user-attachments/assets/c81bc3cc-1738-43f7-ba19-4c4be058427f">
Release Notes:
- N/A
This commit is contained in:
parent
f980e40993
commit
4abf7f058e
3 changed files with 56 additions and 18 deletions
|
@ -803,24 +803,21 @@ fn init_stdout_logger() {
|
|||
Builder::new()
|
||||
.parse_default_env()
|
||||
.format(|buf, record| {
|
||||
use env_logger::fmt::Color;
|
||||
use env_logger::fmt::style::{AnsiColor, Style};
|
||||
|
||||
let subtle = buf
|
||||
.style()
|
||||
.set_color(Color::Black)
|
||||
.set_intense(true)
|
||||
.clone();
|
||||
write!(buf, "{}", subtle.value("["))?;
|
||||
let subtle = Style::new().fg_color(Some(AnsiColor::BrightBlack.into()));
|
||||
write!(buf, "{subtle}[{subtle:#}")?;
|
||||
write!(
|
||||
buf,
|
||||
"{} ",
|
||||
chrono::Local::now().format("%Y-%m-%dT%H:%M:%S%:z")
|
||||
)?;
|
||||
write!(buf, "{:<5}", buf.default_styled_level(record.level()))?;
|
||||
let level_style = buf.default_level_style(record.level());
|
||||
write!(buf, "{level_style}{:<5}{level_style:#}", record.level())?;
|
||||
if let Some(path) = record.module_path() {
|
||||
write!(buf, " {path}")?;
|
||||
}
|
||||
write!(buf, "{}", subtle.value("]"))?;
|
||||
write!(buf, "{subtle}]{subtle:#}")?;
|
||||
writeln!(buf, " {}", record.args())
|
||||
})
|
||||
.init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue