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

Commit

Permalink
longer trace id name
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jan 22, 2024
1 parent 39f9c17 commit 52886f5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions targets/term/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ fn level_color(level: &emit::Level) -> Option<u8> {
}
}

fn hex_slice<'a>(hex: &'a [u8]) -> impl fmt::Display + 'a {
struct HexSlice<'a>(&'a [u8]);
fn hex_slice<'a>(hex: &'a [u8], len: usize) -> impl fmt::Display + 'a {
struct HexSlice<'a>(&'a [u8], usize);

impl<'a> fmt::Display for HexSlice<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(str::from_utf8(&self.0[..4]).unwrap())
f.write_str(str::from_utf8(&self.0[..self.1]).unwrap())
}
}

HexSlice(hex)
HexSlice(hex, len)
}

struct LocalTime {
Expand Down Expand Up @@ -196,7 +196,7 @@ fn print_event(

write_fg(buf, "▓", Color::Ansi256(trace_id_color));
write_plain(buf, " ");
write_plain(buf, hex_slice(&trace_id.to_hex()));
write_plain(buf, hex_slice(&trace_id.to_hex(), 6));
write_plain(buf, " ");
} else {
write_plain(buf, "░ ");
Expand All @@ -206,7 +206,7 @@ fn print_event(

write_fg(buf, "▓", Color::Ansi256(span_id_color));
write_plain(buf, " ");
write_plain(buf, hex_slice(&span_id.to_hex()));
write_plain(buf, hex_slice(&span_id.to_hex(), 4));
write_plain(buf, " ");
}

Expand Down

0 comments on commit 52886f5

Please sign in to comment.