Skip to content

Commit

Permalink
Merge pull request #59 from cardoe/delehef-master
Browse files Browse the repository at this point in the history
Only style the level label
  • Loading branch information
cardoe authored Jan 31, 2024
2 parents c4c36ea + 85550fb commit 5fdb499
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ impl Log for StdErrLog {
let mut writer = io::LineWriter::new(writer.lock());
let color = match record.metadata().level() {
Level::Error => Color::Red,
Level::Warn => Color::Magenta,
Level::Info => Color::Yellow,
Level::Warn => Color::Yellow,
Level::Info => Color::Blue,
Level::Debug => Color::Cyan,
Level::Trace => Color::Blue,
Level::Trace => Color::Magenta,
};
{
// A failure here indicates the stream closed. Do not panic.
Expand Down Expand Up @@ -356,13 +356,14 @@ impl Log for StdErrLog {
Timestamp::Off => {}
}
if self.show_level {
let _ = write!(writer, "{} - ", record.level());
let _ = write!(writer, "{} ", record.level());
}
let _ = writeln!(writer, "{}", record.args());
writer.flush().ok();
{
// A failure here indicates the stream closed. Do not panic.
writer.get_mut().reset().ok();
}
let _ = writeln!(writer, "{}", record.args());
}

fn flush(&self) {
Expand Down

0 comments on commit 5fdb499

Please sign in to comment.