/[pdpsoft]/nl.nikhef.pdp.fetchcrl/tags/fetch-crl-3.0.17-2/FCLog.pm
ViewVC logotype

Diff of /nl.nikhef.pdp.fetchcrl/tags/fetch-crl-3.0.17-2/FCLog.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2690 by davidg, Tue Mar 4 16:26:06 2014 UTC revision 2692 by davidg, Wed Mar 5 19:43:36 2014 UTC
# Line 30  sub new { Line 30  sub new {
30    $obref->{"messagecache"} = ();    $obref->{"messagecache"} = ();
31    $obref->{"warnings"} = 1;    $obref->{"warnings"} = 1;
32    $obref->{"errors"} = 1;    $obref->{"errors"} = 1;
33    $obref->{"rcmode"} = 1;    $obref->{"rcmode"} = "normal";
34    $obref->{"warncount"} = 0;    $obref->{"warncount"} = 0;
35    $obref->{"errorcount"} = 0;    $obref->{"errorcount"} = 0;
36      $obref->{"retrerrorcount"} = 0;
37    $obref->{"syslogfacility"} = "daemon";    $obref->{"syslogfacility"} = "daemon";
38    
39    while ( my $mode = shift ) {    while ( my $mode = shift ) {
# Line 133  sub getrcmode { Line 134  sub getrcmode {
134    
135  sub setrcmode {  sub setrcmode {
136    my ($self,$level) = @_;    my ($self,$level) = @_;
137    
138      if ( $level !~ /^(normal|differentiated|noretrievalerrors)$/ ) {
139        $self->err("Attempt to set rcmode to invalid value of $level");
140        return undef;
141      }
142    
143    my $oldlevel = $self->{"rcmode"};    my $oldlevel = $self->{"rcmode"};
144    $self->{"rcmode"} = $level;    $self->{"rcmode"} = $level;
145    return $oldlevel;    return $oldlevel;
# Line 179  sub retr_err($@) { Line 186  sub retr_err($@) {
186    my $message = "@_";    my $message = "@_";
187    return 1 unless ( $self->{"errors"} );    return 1 unless ( $self->{"errors"} );
188    $self->output("ERROR",$message);    $self->output("ERROR",$message);
189    return 1 unless ( $self->{"rcmode"} );    $self->{"retrerrorcount"}++;
   $self->{"errorcount"}++;  
190    return 1;    return 1;
191  }  }
192    
# Line 224  sub flush($) { Line 230  sub flush($) {
230    }    }
231    $self->{"messagecache"} = ();    $self->{"messagecache"} = ();
232    
233    $self->{"errorcount"} and $self->{"errors"} and return 0;    ($self->{"errorcount"} + $self->{"retrerrorcount"}) and $self->{"errors"} and return 0;
234    $self->{"warningcount"} and $self->{"warnings"} and return 1;    $self->{"warningcount"} and $self->{"warnings"} and return 1;
235    return 1;    return 1;
236  }  }
# Line 233  sub cleanse($) { Line 239  sub cleanse($) {
239    my $self = shift;    my $self = shift;
240    $self->{"messagecache"} = ();    $self->{"messagecache"} = ();
241    $self->{"errorcount"} = 0;    $self->{"errorcount"} = 0;
242      $self->{"retrerrorcount"} = 0;
243    $self->{"warningcount"} = 0;    $self->{"warningcount"} = 0;
244    $self->{"logmode"} = {};    $self->{"logmode"} = {};
245    return 1;    return 1;
# Line 242  sub cleanse($) { Line 249  sub cleanse($) {
249  sub exitstatus($) {  sub exitstatus($) {
250    my $self = shift;    my $self = shift;
251    
252    $self->{"errorcount"} and $self->{"errors"} and return 1;    if ( $self->{"rcmode"} eq "normal" ) {
253        $self->{"errorcount"} and $self->{"errors"} and return 1;
254        $self->{"retrerrorcount"} and $self->{"errors"} and return 1;
255      } elsif ( $self->{"rcmode"} eq "differentiated" ) {
256        $self->{"errorcount"} and $self->{"errors"} and return 1;
257        $self->{"retrerrorcount"} and $self->{"errors"} and return 2;
258      } elsif ( $self->{"rcmode"} eq "noretrievalerrors" ) {
259        $self->{"errorcount"} and $self->{"errors"} and return 1;
260      } else {
261        return 1;
262      }
263    
264    return 0;    return 0;
265  }  }
266    

Legend:
Removed from v.2690  
changed lines
  Added in v.2692

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28