Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pub struct Formatter to defmt_decoder::log. #781

Merged
merged 15 commits into from
Oct 4, 2023
Prev Previous commit
Next Next commit
Simplify
  • Loading branch information
Urhengulas committed Oct 2, 2023

Verified

This commit was signed with the committer’s verified signature.
yegor256 Yegor Bugayenko
commit 6ba4b29cd852f658c5f323630e2d756cf7e41b68
10 changes: 4 additions & 6 deletions decoder/src/log/mod.rs
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ impl DefmtLoggerInfo {
}
}

/// Format [DefmtRecord]s according to a `log_format`.
/// Format [`Frame`]s according to a `log_format`.
///
/// The `log_format` makes it possible to customize the defmt output.
///
@@ -209,17 +209,15 @@ impl Formatter {
};

match level {
Some(_) => Printer::new_defmt(&record, &self.format)
.format_frame()
.unwrap(),
Some(_) => Printer::new_defmt(&record, &self.format),
None => {
// handle defmt::println separately
const RAW_FORMAT: &[LogSegment] = &[LogSegment::new(LogMetadata::Log)];
Printer::new_defmt(&record, RAW_FORMAT)
.format_frame()
.unwrap()
}
}
.format_frame()
.unwrap()
}
}
}