feat(log): emit build-started JSON message with run_id #16632
feat(log): emit build-started JSON message with run_id #16632weihanglo wants to merge 2 commits intorust-lang:masterfrom
Conversation
This test documents the current behavior when using both `-Zbuild-analysis` and `--message-format=json`.
When both `-Zbuild-analysis` and `--message-format=json` are enabled,
emit a `build-started` JSON message to stdout containing the `run_id`.
This allows external tools to associate the JSON output stream
with the corresponding log file in `~/.cargo/log/{run_id}.jsonl`.
While a better design of JSON message and structured logging is needed,
this provides a temporary workaround for those needing the old
`--timings=json` flag
Closes rust-lang#16576
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Until a better solution is out, I think this is sufficient for your use case (with some extra probe to |
|
So, for my use-case with rustwide, it doesn't help :( Because If the writing into CARGO_HOME ever became performed default, I guess this would also currently break crater 😆 |
|
I think we have a few options here:
The second one is less ambiguous and straightforward to implement, though I am not sure if that meets your use case |
|
It would work for the Docker/container use-case, and making the log dir be configurable sounds like a good idea regardless. (streaming to stdout would also be appreciated, but I guess that can wait until there's more design work done on -Zbuild-analysis) |
What does this PR try to resolve?
When both
-Zbuild-analysisand--message-format=jsonare enabled,emit a
build-startedJSON message to stdout containing therun_id.This allows external tools to associate the JSON output stream
with the corresponding log file in
~/.cargo/log/{run_id}.jsonl.While a better design of JSON message and structured logging is needed,
this provides a temporary workaround for those needing the old
--timings=jsonflag.Closes #16576
How to test and review this PR?
Commit by commit.