Skip to content

Commit

Permalink
Fix compilation with new env_logger.
Browse files Browse the repository at this point in the history
  • Loading branch information
de-vri-es committed Aug 29, 2024
1 parent af1569c commit efa3b50
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dynamixel2-cli/src/bin/dynamixel2/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub fn init(root_module: &str, verbosity: i8) {

env_logger::Builder::new()
.format(|buffer, record: &log::Record| {
use env_logger::fmt::Color;
use env_logger::fmt::style;

let mut prefix_style = buffer.style();
let mut prefix_style = style::Style::new();
let prefix;

match record.level() {
Expand All @@ -26,15 +26,15 @@ pub fn init(root_module: &str, verbosity: i8) {
},
log::Level::Warn => {
prefix = "Warning: ";
prefix_style.set_color(Color::Yellow).set_bold(true);
prefix_style = prefix_style.fg_color(Some(style::AnsiColor::Yellow.into())).bold();
},
log::Level::Error => {
prefix = "Error: ";
prefix_style.set_color(Color::Red).set_bold(true);
prefix_style = prefix_style.fg_color(Some(style::AnsiColor::Red.into())).bold();
},
};

writeln!(buffer, "{}{}", prefix_style.value(prefix), record.args(),)
writeln!(buffer, "{prefix_style}{prefix}{prefix_style:#} {}", record.args(),)
})
.filter_level(log::LevelFilter::Warn)
.filter_module(root_module, log_level)
Expand Down

0 comments on commit efa3b50

Please sign in to comment.