Summary:
PR changes:
* Adds `--output [text/json]` CLI option which sets the `outputFormat` config flag
* When output is set to JSON, it implies the `--sc` option and directs all logs to `stderr`. This allows to easily capture a clean JSON output using `memlab > result.json`.
* Adds `getJSONifyableObject` to the interfaces of nodes and edges
* Updates `printNodeListInTerminal` and `printReferencesInTerminal` to support JSON output
* Updates `CollectionsHoldingStaleAnalysis` to support JSON output
Open questions:
* Should all analyses support JSON output? I only added the ones I need at the moment.
* The output from `getJSONifyableObject` has inconsistent casing (e.g. snake `self_size` vs. camel `incomingEdgeCount`). Is it a breaking change to change this so it's all the same? Which case is preferrred?
Fixes https://github.com/facebook/memlab/issues/127
Pull Request resolved: https://github.com/facebook/memlab/pull/128
Reviewed By: twobassdrum
Differential Revision: D61724639
Pulled By: JacksonGL
fbshipit-source-id: 13a056be1c421999ffbd988ee5f85026d66c860d