-
Notifications
You must be signed in to change notification settings - Fork 9
JSON Reporting #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
JSON Reporting #80
Conversation
assert(globals._odrv_count == violations.size()); | ||
|
||
if (json_mode && globals._fp.is_open()) { | ||
globals._fp << orc::to_json(violations); |
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.
This is where the JSON object is serialized to the file.
@@ -85,8 +87,10 @@ template <class F> | |||
void ostream_safe(std::ostream& s, F&& f) { | |||
std::lock_guard<std::mutex> lock{ostream_safe_mutex()}; | |||
std::forward<F>(f)(s); | |||
if (globals::instance()._fp.is_open()) { | |||
std::forward<F>(f)(globals::instance()._fp); | |||
if (settings::instance()._output_file_mode == settings::output_file_mode::json) return; |
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.
This circumvents writing anything to the file if we're in json output mode.
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.
Looks good!
This PR adds a new flag to ORC's config file,
output_file_mode
. Fixes #79.The flag determines what format should be used for content written to external report files defined by either
output_file
orrelative_output_file
. The options aretext
orjson
.text
will mirror all output sent tostdout
andstderr
to the file.json
will limit output file contents to the ODRV report. This mode enumerates all object files with conflicting symbols, so can be quite verbose. It is intended for programmatic consumption. The default value istext
.This PR also removes the
resource_metrics
capability of the tool. It's been decided Tracy is a better solution to meet such a need. Therefore the flag and the code associated with supporting it have been pulled out.An example snippet of the JSON output looks something like: