Analyzer CLI: fix machine format in build mode.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2885063002 .
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index cde1ab8..34e2c16 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -368,9 +368,13 @@
    */
   void _printErrors({String outputPath}) {
     StringBuffer buffer = new StringBuffer();
-    ErrorFormatter formatter = new HumanErrorFormatter(buffer, options, stats,
-        severityProcessor: (AnalysisError error) => determineProcessedSeverity(
-            error, options, context.analysisOptions));
+    var severityProcessor = (AnalysisError error) =>
+        determineProcessedSeverity(error, options, context.analysisOptions);
+    ErrorFormatter formatter = options.machineFormat
+        ? new MachineErrorFormatter(buffer, options, stats,
+            severityProcessor: severityProcessor)
+        : new HumanErrorFormatter(buffer, options, stats,
+            severityProcessor: severityProcessor);
     for (Source source in explicitSources) {
       AnalysisErrorInfo errorInfo = context.getErrors(source);
       formatter.formatErrors([errorInfo]);