From: adefaria Date: Sat, 11 Oct 2014 00:47:13 +0000 (-0700) Subject: Changed so that if Stats is logging to a Logger object it checks to see X-Git-Url: https://defaria.com/gitweb/?a=commitdiff_plain;h=b7aaa136bd4ad909325b0e5da59daa607233ae27;p=clearscm.git Changed so that if Stats is logging to a Logger object it checks to see if there are any errors or warnings and reports them. --- diff --git a/lib/Utils.pm b/lib/Utils.pm index a523461..a21d996 100644 --- a/lib/Utils.pm +++ b/lib/Utils.pm @@ -827,7 +827,8 @@ and the values of the hash will be the counters. =item $log -Logger object to log stats to (if specified) +Logger object to log stats to (if specified). Note: if the Logger object has +errors or warnings then they will be automatically included in the output. =back @@ -849,7 +850,12 @@ Returns: my $msg = "$FindBin::Script Run Statistics:"; - if (scalar keys %$total) { + if ($log and ref $log eq 'Logger') { + $total->{errors} = $log->{errors}; + $total->{warnings} = $log->{warnings}; + } # if + + if (keys %$total) { # Display statistics (if any) if ($log) { $log->msg ($msg); @@ -858,10 +864,10 @@ Returns: } # if foreach (sort keys %$total) { - $msg = $$total{$_} . "\t $_"; + $msg = $total->{$_} . "\t $_"; if ($log) { - $log->msg ($$total{$_} . "\t $_"); + $log->msg ($total->{$_} . "\t $_"); } else { display $msg; } # if