Commit cc27e302 authored by nednguyen's avatar nednguyen Committed by Commit bot

[Telemetry] Add indentation to json_output & chart_json_output.

Rationale: ocassionally I find it useful to look at json_output to debug.
Indenting the file make it a lot more readable. The downside is this increases
the file size, but it shouldn't matter for small files like these.

An example Results.json with ~2000 values tested on local machine:
Without indent: 472K
With indentation: 692K

Review URL: https://codereview.chromium.org/940123003

Cr-Commit-Position: refs/heads/master@{#317175}
parent 971fb92c
...@@ -71,5 +71,5 @@ class ChartJsonOutputFormatter(output_formatter.OutputFormatter): ...@@ -71,5 +71,5 @@ class ChartJsonOutputFormatter(output_formatter.OutputFormatter):
self._benchmark_metadata, self._benchmark_metadata,
page_test_results.all_page_specific_values, page_test_results.all_page_specific_values,
page_test_results.all_summary_values), page_test_results.all_summary_values),
self.output_stream) self.output_stream, indent=2)
self.output_stream.write('\n') self.output_stream.write('\n')
...@@ -53,5 +53,5 @@ class JsonOutputFormatter(output_formatter.OutputFormatter): ...@@ -53,5 +53,5 @@ class JsonOutputFormatter(output_formatter.OutputFormatter):
def Format(self, page_test_results): def Format(self, page_test_results):
json.dump( json.dump(
ResultsAsDict(page_test_results, self.benchmark_metadata), ResultsAsDict(page_test_results, self.benchmark_metadata),
self.output_stream) self.output_stream, indent=2)
self.output_stream.write('\n') self.output_stream.write('\n')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment