IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 21, 2010, 11:46:46 AM (16 years ago)
Author:
Paul Price
Message:

Cleaning up and adding more failure modes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/errors.pl

    r27633 r27720  
    102102my %neb_entry;
    103103my %variance;
     104my %error_reading;
    104105my %unknown;
    105106my %bad;
     
    199200            last;
    200201        }
     202        if ($line =~ /Error reading .*, (\S+)/) {
     203            $error_reading{$name} = $1;
     204            $found = 1;
     205            last;
     206        }
    201207    }
    202208    $unknown{$name} = $log unless $found;
     
    207213print "\n";
    208214
    209 if (scalar keys %assertion) {
    210     print "Assertion failures: " . ( scalar keys %assertion ) . "\n";
    211     foreach my $name (keys %assertion) {
    212         print "$name: $assertion{$name}\n";
    213     }
    214     print "\n";
     215print_failure(\%assertion, "Assertion failures");
     216print_failure(\%cannot_find_file, "'Cannot find file' errors");
     217print_failure(\%unable_access, "'Unable to access file' errors");
     218print_failure(\%failed_real_name, "'Failed to determine real name' errors");
     219print_failure(\%failed_close, "'Failed to close' errors");
     220print_failure(\%transparencies, "'Unable to perform statistics on transparencies' errors");
     221print_failure(\%couldnt_open_file, "'Could not open file' errors");
     222print_failure(\%failed_read, "'Failed to read' errors");
     223print_failure(\%no_instances_available, "'No instances available' errors");
     224print_failure(\%neb_entry, "'Neb entry not found' errors");
     225print_failure(\%variance, "'Variance renormalisation' errors");
     226print_failure(\%error_reading, "'Error reading' errors");
     227print_failure(\%unknown, "Unknown errors");
     228print_failure(\%bad, "Bad logs");
     229
     230### Pau.
     231
     232sub print_failure
     233{
     234    my $data = shift;           # Data
     235    my $desc = shift;           # Description
     236
     237    if (scalar keys %$data) {
     238        print "$desc: " . (scalar keys %$data) . "\n";
     239        foreach my $name (keys %$data) {
     240            print "$name: $$data{$name}\n";
     241        }
     242        print "\n";
     243    }
     244    return 1;
    215245}
    216 
    217 if (scalar keys %cannot_find_file) {
    218     print "'Cannot find file' errors: " . ( scalar keys %cannot_find_file ) . "\n";
    219     foreach my $name (keys %cannot_find_file) {
    220         print "$name: $cannot_find_file{$name}\n";
    221     }
    222     print "\n";
    223 }
    224 
    225 if (scalar keys %unable_access) {
    226     print "'Unable to access file' errors: " . ( scalar keys %unable_access ) . "\n";
    227     foreach my $name (keys %unable_access) {
    228         print "$name: $unable_access{$name}\n";
    229     }
    230     print "\n";
    231 }
    232 
    233 if (scalar keys %failed_real_name) {
    234     print "'Failed to determine real name' errors: " . ( scalar keys %failed_real_name ) . "\n";
    235     foreach my $name (keys %failed_real_name) {
    236         print "$name: $failed_real_name{$name}\n";
    237     }
    238     print "\n";
    239 }
    240 
    241 if (scalar keys %failed_close) {
    242     print "'Failed to close' errors: " . ( scalar keys %failed_close ) . "\n";
    243     foreach my $name (keys %failed_close) {
    244         print "$name: $failed_close{$name}\n";
    245     }
    246     print "\n";
    247 }
    248 
    249 if (scalar keys %transparencies) {
    250     print "'Unable to perform statistics on transparencies' errors: " . ( scalar keys %transparencies ) . "\n";
    251     foreach my $name (keys %transparencies) {
    252         print "$name: $transparencies{$name}\n";
    253     }
    254     print "\n";
    255 }
    256 
    257 if (scalar keys %couldnt_open_file) {
    258     print "'Could not open file' errors: " . ( scalar keys %couldnt_open_file ) . "\n";
    259     foreach my $name (keys %couldnt_open_file) {
    260         print "$name: $couldnt_open_file{$name}\n";
    261     }
    262     print "\n";
    263 }
    264 
    265 if (scalar keys %failed_read) {
    266     print "'failed to read' errors: " . ( scalar keys %failed_read ) . "\n";
    267     foreach my $name (keys %failed_read) {
    268         print "$name: $failed_read{$name}\n";
    269     }
    270     print "\n";
    271 }
    272 
    273 if (scalar keys %no_instances_available) {
    274     print "'no instances available' errors: " . ( scalar keys %no_instances_available ) . "\n";
    275     foreach my $name (keys %no_instances_available) {
    276         print "$name: $no_instances_available{$name}\n";
    277     }
    278     print "\n";
    279 }
    280 
    281 if (scalar keys %neb_entry) {
    282     print "'neb entry not found' errors: " . ( scalar keys %neb_entry ) . "\n";
    283     foreach my $name (keys %neb_entry) {
    284         print "$name: $neb_entry{$name}\n";
    285     }
    286     print "\n";
    287 }
    288 
    289 if (scalar keys %variance) {
    290     print "'variance renormalisation' errors: " . ( scalar keys %variance ) . "\n";
    291     foreach my $name (keys %variance) {
    292         print "$name: $variance{$name}\n";
    293     }
    294     print "\n";
    295 }
    296 
    297 if (scalar keys %unknown) {
    298     print "Unknown errors: " . ( scalar keys %unknown ) . "\n";
    299     foreach my $name (keys %unknown) {
    300         print "$name: $unknown{$name}\n";
    301     }
    302     print "\n";
    303 }
    304 
    305 if (scalar keys %bad) {
    306     print "Bad logs: " . ( scalar keys %bad ) . "\n";
    307     foreach my $name (keys %bad) {
    308         print "$name: $bad{$name}\n";
    309     }
    310     print "\n";
    311 }
Note: See TracChangeset for help on using the changeset viewer.