Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #60 from knurling-rs/tweak-output
Browse files Browse the repository at this point in the history
tweak output format
  • Loading branch information
japaric authored Sep 8, 2020
2 parents dae6430 + 1e315a7 commit 77df3d5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ impl Log for Logger {
format!("(HOST)")
};

let mod_path = record.module_path().unwrap_or("");

self.timing_align
.fetch_max(timestamp.len(), Ordering::Relaxed);

Expand All @@ -122,23 +120,24 @@ impl Log for Logger {

writeln!(
sink,
"{timestamp:>0$} {level:5} {module:9} | {args}",
"{timestamp:>0$} {level:5} {args}",
self.timing_align.load(Ordering::Relaxed),
timestamp = timestamp,
level = record.level().to_string().color(level_color),
module = mod_path,
args = record.args(),
args = record.args().to_string().bold(),
)
.ok();

if let Some(file) = record.file() {
// NOTE will be `Some` if `file` is `Some`
let mod_path = record.module_path().unwrap();
// Always include location info for defmt output.
if is_defmt || self.verbose {
let mut loc = file.to_string();
if let Some(line) = record.line() {
loc.push_str(&format!(":{}", line));
}
writeln!(sink, "└─ {}", loc.dimmed()).ok();
writeln!(sink, "{}", format!("└─ {} @ {}", mod_path, loc).dimmed()).ok();
}
}
}
Expand Down

0 comments on commit 77df3d5

Please # to comment.