Skip to content

Commit

Permalink
Add a json output option
Browse files Browse the repository at this point in the history
Reviewed By: voideanvalue

Differential Revision: D52855914

fbshipit-source-id: 5345a12c851d9dabc2ae291c2e4c6adcd4f0c9bb
  • Loading branch information
tyao1 authored and facebook-github-bot committed Jan 19, 2024
1 parent 49e4da1 commit 4619f97
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions compiler/crates/relay-compiler/src/status_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,23 @@ impl StatusReporter for ConsoleStatusReporter {
}
}
}

pub struct JSONStatusReporter;

impl StatusReporter for JSONStatusReporter {
fn build_starts(&self) {}

fn build_completes(&self, diagnostics: &[Diagnostic]) {
println!(
"{{\"completed\":true,\"diagnostics\":{}}}",
serde_json::to_string(diagnostics).unwrap()
);
}

fn build_errors(&self, error: &Error) {
println!(
"{{\"completed\":false,\"error\":{}}}",
serde_json::to_string(error).unwrap()
);
}
}

0 comments on commit 4619f97

Please sign in to comment.