-
Notifications
You must be signed in to change notification settings - Fork 80
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
Format trace to JSON format #754
Conversation
Note : it is possible that we are not outputting valid json yet (for instance, numbers are a footgun in json, and it seems that numbers with an unset fractional part are not accepted : e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! An area that could be improved is the UI: we have 3 different flags for traces, and specifying an output file for example doesn't imply that the trace should be on.
Ideas:
- make the trace output file be an optional argument of
--trace
, so that no extra flag is needed (note though: it could break existing scripts that do e.g.catala interpret -t foo.catala_en
becausefoo.catala_en
would be taken as the argument of-t
; we don't have that many scripts around and I still think it's ok, though) - add environment variables for the flags (in particular, that could be useful for the trace format)
- infer the trace format from the output file name if
.json
This may require some habit of Cmdliner so I can help ^^
Adding the output file as an option of the |
yes that's the caveat I pointed to before: we should fix the scripts, either by expliciting |
Now that the catala-example CI has a candidate fix ( CatalaLang/catala-examples#19 ), the main issue remaining in the CI is that some messages have a different format, due to a few issues of |
I wrote a workaround so that the format, when printing to the console, is the same as before (when in a file the |
- don't duplicate Message.*ppf printers - adjust some formatting details
@rprimet basically the last bug was that we were duplicating the formatter generated on top of stdout, which led to erratic behaviours when both versions were being used; should be all OK now. |
Thanks @AltGr ! |
Based on @rprimet's, excellent suggestion, we want to print the trace by the interpreter in a JSON format that could be exploitable by debug tools. However, the parsing of raw events to events is broken now and needs to be fixed. In the meantime, this PR prints the list of raw events on the standard output in JSON format.