Przeglądaj źródła

Fix logdirs, was initializing days and totallines for every logfile parsed,
it should only be done just before we start to parse_dir or parse_file.

Morten Brix Pedersen 25 lat temu
rodzic
commit
936befb78a
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      modules/Pisg/Parser/Logfile.pm

+ 4 - 2
modules/Pisg/Parser/Logfile.pm

@@ -55,6 +55,10 @@ sub analyze
     if (defined $self->{parser}) {
     if (defined $self->{parser}) {
         my $starttime = time();
         my $starttime = time();
 
 
+        # Just initialize these to 0
+        $stats{days} = 0;
+        $stats{totallines} = 0;
+
         if ($self->{cfg}->{logdir}) {
         if ($self->{cfg}->{logdir}) {
             # Run through all files in dir
             # Run through all files in dir
             $self->_parse_dir(\%stats, \%lines);
             $self->_parse_dir(\%stats, \%lines);
@@ -142,8 +146,6 @@ sub _parse_file
     my $lastnormal = "";
     my $lastnormal = "";
     my $repeated;
     my $repeated;
 
 
-    $stats->{days} = 0;
-    $stats->{totallines} = 0;
 
 
     while(my $line = <LOGFILE>) {
     while(my $line = <LOGFILE>) {
         $line = _strip_mirccodes($line);
         $line = _strip_mirccodes($line);