Skip to content

Commit

Permalink
Include source info when writing logs
Browse files Browse the repository at this point in the history
Before:
2023-07-12T15:59:18.091023Z: ThreadId(1): DEBUG: 7624 glyphs identified
After:
[2023-07-12T15:58:38.552647Z ThreadId(1) ufo2fontir::source DEBUG] 7624 glyphs identified`

So this is slightly more verbose, but knowing where a message was logged
from is very helpful when debugging. If we want to shave more characters
we can use millis instead of micros in the timestamp, and assign custom
thread names in the threadpool.
  • Loading branch information
cmyr committed Jul 12, 2023
1 parent 06bb49e commit 30a0270
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fontc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ fn main() -> Result<(), Error> {
let ts = buf.timestamp_micros();
writeln!(
buf,
"{}: {:?}: {}: {}",
ts,
"[{ts} {:?} {} {}] {}",
std::thread::current().id(),
record.target(),
buf.default_level_style(record.level())
.value(record.level()),
record.args()
Expand Down

0 comments on commit 30a0270

Please sign in to comment.