]> granicus.if.org Git - pgbadger/commitdiff
Fix option -f | --format that was not applied on all files get from the parameter...
authorGilles Darold <gilles@darold.net>
Tue, 10 Sep 2019 04:47:43 +0000 (06:47 +0200)
committerGilles Darold <gilles@darold.net>
Tue, 10 Sep 2019 04:47:43 +0000 (06:47 +0200)
pgbadger

index 6b97f297baca2b6e3e4cbf2f1ba913996d07c3cc..4fd17ef3e1d21025022b501e410f49956805719b 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -1382,7 +1382,9 @@ if ($incremental && !$remote_host)
                else
                {
                        # Auto detect log format for proper parsing
-                       my $fmt = autodetect_format($f, $file_size{$f});
+                       my $fmt = $format || 'stderr';
+                       $fmt = autodetect_format($f, $file_size{$f});
+                       $fmt ||= $format;
 
                        # Set regex to parse the log file
                        $fmt = set_parser_regex($fmt);
@@ -15966,7 +15968,7 @@ sub autodetect_format
                                $nfound++ if ($f);
                                $fmt = $f;
                                $ident_name{$i}++ if ($i);
-                               last if (($nfound > 10) || ($nline > 5000));
+                               last if (($nfound >= 10) || ($nline > 5000));
                        }
                        $tfile->close();
                }
@@ -16011,8 +16013,9 @@ sub autodetect_format
                        }
                }
        }
-       else
+       elsif (!$fmt)
        {
+               # Force format if forced as parameter with -f
                $fmt = $format;
        }