@@ -194,8 +194,11 @@ namespace vix::commands::logs::runner
194194 const std::string appCommand =
195195 build_journalctl_analysis_command (cfg, options);
196196
197- output::step (std::cout, " Analyze App Errors" );
198- output::ok (std::cout, " reading systemd app errors" );
197+ if (!options.json )
198+ {
199+ output::step (std::cout, " Analyze App Errors" );
200+ output::ok (std::cout, " reading systemd app errors" );
201+ }
199202
200203 std::vector<std::string> appLines =
201204 read_command_lines (appCommand);
@@ -215,8 +218,11 @@ namespace vix::commands::logs::runner
215218 options,
216219 false );
217220
218- output::step (std::cout, " Analyze Proxy Errors" );
219- output::ok (std::cout, " reading Nginx proxy errors" );
221+ if (!options.json )
222+ {
223+ output::step (std::cout, " Analyze Proxy Errors" );
224+ output::ok (std::cout, " reading Nginx proxy errors" );
225+ }
220226
221227 std::vector<std::string> proxyLines =
222228 read_command_lines (proxyCommand);
@@ -226,7 +232,7 @@ namespace vix::commands::logs::runner
226232 proxyLines.begin (),
227233 proxyLines.end ());
228234 }
229- else
235+ else if (!options. json )
230236 {
231237 output::warn (
232238 std::cerr,
@@ -240,7 +246,10 @@ namespace vix::commands::logs::runner
240246 const analyzer::RepeatedLogReport report =
241247 analyzer::analyze_repeated_errors (lines);
242248
243- analyzer::print_repeated_report (std::cout, report);
249+ if (options.json )
250+ analyzer::print_repeated_report_json (std::cout, report);
251+ else
252+ analyzer::print_repeated_report (std::cout, report);
244253
245254 return true ;
246255 }
@@ -356,7 +365,11 @@ namespace vix::commands::logs::runner
356365 const LogsConfig &cfg,
357366 const LogsOptions &options)
358367 {
359- output::print_summary (std::cout, cfg, options);
368+ if (!options.json )
369+ output::print_summary (std::cout, cfg, options);
370+
371+ if (options.repeated )
372+ return show_repeated_errors (cfg, options) ? 0 : 1 ;
360373
361374 if (options.repeated )
362375 return show_repeated_errors (cfg, options) ? 0 : 1 ;
0 commit comments