]> granicus.if.org Git - pgbadger/commitdiff
Remove everything that error_info from json output when -w | --watch-mode is enable...
authorDarold Gilles <gilles@darold.net>
Mon, 3 Nov 2014 19:31:16 +0000 (20:31 +0100)
committerDarold Gilles <gilles@darold.net>
Mon, 3 Nov 2014 19:31:16 +0000 (20:31 +0100)
pgbadger

index acd23f0f86e5dc242a814cec7be460085c80ba62..29d4beecc67a6bf7466666884b7b82bc68de2728 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -1298,7 +1298,11 @@ if (!$incremental && ($#given_log_files >= 0) ) {
                                &dump_as_text();
                        }
                } elsif ($extension eq 'json') {
-                       &dump_as_json();
+                       if ($error_only) {
+                               &dump_error_as_json();
+                       } else {
+                               &dump_as_json();
+                       }
                } elsif ($extension eq 'binary') {
                        &dump_as_binary($fh);
                } else {
@@ -8655,6 +8659,15 @@ sub dump_as_binary
        }, $lfh) || die ("Couldn't save binary data to «$outfile»!\n");
 }
 
+sub dump_error_as_json
+{
+       my $json = encode_json({
+               'error_info' => \%error_info,
+       }) || die ("Encode object to JSON failed!\n");
+
+       print $fh $json;
+}
+
 sub dump_as_json
 {
        my $json = encode_json({