Skip to content

Commit

Permalink
Add support for log_format option for defmt_decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
andresovela committed Jul 15, 2023
1 parent 4cf82a9 commit 29b5c12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ pub struct Opts {
#[arg(long)]
list_probes: bool,

/// Applies the given format to the log output.
#[arg(long)]
pub log_format: Option<String>,

/// Whether to measure the program's stack consumption.
#[arg(long)]
pub measure_stack: bool,
Expand Down Expand Up @@ -106,8 +110,9 @@ const HELPER_CMDS: [&str; 3] = ["list_chips", "list_probes", "version"];
pub fn handle_arguments() -> anyhow::Result<i32> {
let opts = Opts::parse();
let verbose = opts.verbose;
let log_format = opts.log_format.as_ref().map(|s| s.as_str());

defmt_decoder::log::init_logger(verbose >= 1, opts.json, move |metadata| {
defmt_decoder::log::init_logger(log_format, opts.json, move |metadata| {
if defmt_decoder::log::is_defmt_frame(metadata) {
true // We want to display *all* defmt frames.
} else {
Expand Down

0 comments on commit 29b5c12

Please sign in to comment.