Conversation
japaric
left a comment
There was a problem hiding this comment.
thanks. I left some suggestions.
| - [`probe-run`], parses data sent over RTT (ARM Cortex-M only). | ||
| > 💡 If you are using the git version of defmt, make sure you also install the tool from git and not crates.io. | ||
|
|
||
| Since v0.3.3, `probe-run` has now a [`--json`] flag to format the output. |
There was a problem hiding this comment.
I think we should say that the main goal of --json is to produce machine readable output. one of the use cases for that is changing the human-readable format
|
|
||
| It indicates the version of the json format you are using. `probe-run` will always output it as a header at the beginning of each stream of logs. We anticipate that the format will slightly change while `probe-run` and `defmt` evolve. Using this version you always know which revision is in use and can act upon that. | ||
|
|
||
| > 🤔: What if I want formatted output? |
There was a problem hiding this comment.
I think this questions overlaps with the one that says "what can I do with the JSON output?". I would suggest simply mentioning that one use case is changing the human readable output and the piped command. jq without any flags is not a good example of human readable output, maybe change it to only show the data field?
There was a problem hiding this comment.
I can also remove the whole reference to jq, as it is not relevant information here.
japaric
left a comment
There was a problem hiding this comment.
Not part of this PR but could you fix this line; it has a missing link:
To do that, we supply a few things in [defmt_json_schema]:
| {"data":"println","host_timestamp":1643113389707313290,"level":null,"location":{"file":"src/bin/levels.rs","line":15,"module_path":{"crate_name":"levels","modules":[],"function":"__cortex_m_rt_main"}},"target_timestamp":"4"} | ||
| ``` | ||
|
|
||
| One use case is changing the human readable output with a piped command. |
There was a problem hiding this comment.
I would suggest moving this addition to the very end and mention that jq is an existing tool that can be used to change the output format. But again, the example output should be be JSON but something more readable.
There was a problem hiding this comment.
Do you mean what is above, or what is under?
{
"data": "I am a PRINTLN-statement",
"host_timestamp": 1647942992494142200,
"level": null,
"location": {
//...
}
},
}There was a problem hiding this comment.
But again, the example output should be be JSON but something more readable.
should not be JSON.
by "example output" I meant the code block. Ideally, it should be something like
$ cargo r --example foo | jq "something here"
I am a PRINTLN-statement
the next log statementThere was a problem hiding this comment.
I would suggest moving this addition to the very end and mention that
jqis an existing tool that can be used to change the output format. But again, the example output should be be JSON but something more readable.
Dumb question, do you mean at the very end of the page or the very end of the paragraph? I fear it will be a bit out of context at the very end of the page.
There was a problem hiding this comment.
I meant at the end of the page. After re-reading the page I think a good place may be after the first paragraph of the "Data transfer objects"
So, what can I do with the JSON output?
There really are no boundaries. (..)
(NEW) One option is to use a program likejqto extract the parts of interest. blah blah show console example
If you wish to deserialize (..)
There was a problem hiding this comment.
Maybe that sentence is enough ⬆️ . Everybody already saw a json output. The console example does not bring anything.
There was a problem hiding this comment.
ok, the sentence can be enough but I guess it should say "pipe to a program like jq" instead of "use"
I don't think the link is very informative... I will remove the linking instead, since Johann wrote extensive information. |
I think the link still helps because you can tell it's a crate and what version it's available. |
|
thanks! |
|
Build succeeded: |
--jsonflag)