Skip to content

Commit ea22487

Browse files
Merge #535
535: Don't print leading space when timestamp is absent r=japaric a=jonas-schievink This was causing aesthetically unpleasing output and thus makes defmt completely unusable: ``` INFO (11/11) running `ext_roundtrip`... └─ integration::tests::__defmt_test_entry @ tests/integration.rs:330 INFO all tests passed! └─ integration::tests::__defmt_test_entry @ tests/integration.rs:4 ``` Now it should look like ``` INFO (11/11) running `ext_roundtrip`... └─ integration::tests::__defmt_test_entry @ tests/integration.rs:330 INFO all tests passed! └─ integration::tests::__defmt_test_entry @ tests/integration.rs:4 ``` Fixes knurling-rs/probe-run#230 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 parents 09278af + 7a131de commit ea22487

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

decoder/src/log.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,14 @@ impl<'a> Printer<'a> {
152152
pub fn print_colored<W: io::Write>(&self, sink: &mut W) -> io::Result<()> {
153153
writeln!(
154154
sink,
155-
"{timestamp:>0$} {level:5} {args}",
155+
"{timestamp:>0$}{spacing}{level:5} {args}",
156156
self.min_timestamp_width,
157157
timestamp = self.record.timestamp(),
158+
spacing = if self.record.timestamp().is_empty() {
159+
""
160+
} else {
161+
" "
162+
},
158163
level = self
159164
.record
160165
.level()

0 commit comments

Comments
 (0)