Skip to content

Commit

Permalink
Merge pull request #2442 from harismuzaffer/add-lno-to-logs
Browse files Browse the repository at this point in the history
chore(logging): add line number to log records
  • Loading branch information
maqi authored Nov 20, 2024
2 parents e417b8a + 80173f6 commit 41739f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sn_logging/src/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ where
// Write level and target
let level = *event.metadata().level();
let module = event.metadata().module_path().unwrap_or("<unknown module>");
let lno = event.metadata().line().unwrap_or(0);
let time = SystemTime;

write!(writer, "[")?;
time.format_time(&mut writer)?;
write!(writer, " {level} {module}")?;
write!(writer, " {level} {module} {lno}")?;
ctx.visit_spans(|span| write!(writer, "/{}", span.name()))?;
write!(writer, "] ")?;

Expand Down

0 comments on commit 41739f1

Please sign in to comment.