projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added some more stats
[clearscm.git]
/
lib
/
Logger.pm
diff --git
a/lib/Logger.pm
b/lib/Logger.pm
index
4d31d3e
..
f442cc6
100644
(file)
--- a/
lib/Logger.pm
+++ b/
lib/Logger.pm
@@
-88,7
+88,7
@@
my $me;
BEGIN {
# Extract relative path and basename from script name.
$me = $FindBin::Script;
BEGIN {
# Extract relative path and basename from script name.
$me = $FindBin::Script;
-
+
# Remove .pl for Perl scripts that have that extension
$me =~ s/\.pl$//;
} # BEGIN
# Remove .pl for Perl scripts that have that extension
$me =~ s/\.pl$//;
} # BEGIN
@@
-164,10
+164,11
@@
Returns:
my $disposition = $parms{disposition} ? $parms{disposition} : 'perm';
my $timestamped = $parms{timestamped} ? $parms{timestamped} : 'FALSE';
my $append = $parms{append} ? '>>' : '>';
my $disposition = $parms{disposition} ? $parms{disposition} : 'perm';
my $timestamped = $parms{timestamped} ? $parms{timestamped} : 'FALSE';
my $append = $parms{append} ? '>>' : '>';
- my $extension = $parms{extension} ? $parms{extension} : 'log';
my $logfile;
my $logfile;
- $name = "$name.$extension";
+ if (defined $parms{extension}) {
+ $name .= ".$parms{extension}" unless $parms{extension} eq '';
+ } # if
open $logfile, $append, "$path/$name"
or error "Unable to open logfile $path/$name - $!", 1;
open $logfile, $append, "$path/$name"
or error "Unable to open logfile $path/$name - $!", 1;
@@
-175,10
+176,8
@@
Returns:
# Set unbuffered output
$logfile->autoflush ();
# Set unbuffered output
$logfile->autoflush ();
- set_verbose
- if $ENV{VERBOSE};
- set_debug
- if $ENV{DEBUG};
+ set_verbose if $ENV{VERBOSE};
+ set_debug if $ENV{DEBUG};
return bless {
path => $path,
return bless {
path => $path,
@@
-236,13
+235,13
@@
Returns:
} # while
close $file;
} # while
close $file;
-
+
return;
} # append
sub name () {
my ($self) = @_;
return;
} # append
sub name () {
my ($self) = @_;
-
+
=pod
=head3 name
=pod
=head3 name
@@
-280,7
+279,7
@@
Returns:
sub fullname () {
my ($self) = @_;
sub fullname () {
my ($self) = @_;
-
+
=pod
=head3 fullname
=pod
=head3 fullname
@@
-359,9
+358,9
@@
Returns:
=cut
$self->log ($msg, $nolinefeed);
=cut
$self->log ($msg, $nolinefeed);
-
+
verbose $msg, undef, $nolinefeed;
verbose $msg, undef, $nolinefeed;
-
+
return;
} # msg
return;
} # msg
@@
-408,9
+407,9
@@
Returns:
=cut
$self->log ($msg, $nolinefeed);
=cut
$self->log ($msg, $nolinefeed);
-
+
display $msg, undef, $nolinefeed;
display $msg, undef, $nolinefeed;
-
+
return;
} # disp
return;
} # disp
@@
-452,13
+451,15
@@
Returns:
=cut
$increment ||= 1;
=cut
$increment ||= 1;
-
+
$self->{errors} += $increment;
$self->{errors} += $increment;
+
+ return;
} # incrementErr
sub err ($;$) {
my ($self, $msg, $errno) = @_;
} # incrementErr
sub err ($;$) {
my ($self, $msg, $errno) = @_;
-
+
=pod
=head3 err ($msg, $errno)
=pod
=head3 err ($msg, $errno)
@@
-511,11
+512,11
@@
Returns:
} # if
$self->log ($msg);
} # if
$self->log ($msg);
-
+
$self->incrementErr;
$self->incrementErr;
-
+
exit $errno if $errno;
exit $errno if $errno;
-
+
return;
} # err
return;
} # err
@@
-591,10
+592,10
@@
Returns:
footing => $footing,
data => $logfile
);
footing => $footing,
data => $logfile
);
-
+
close $logfile
or error "Unable to close logfile $log_filename", 1;
close $logfile
or error "Unable to close logfile $log_filename", 1;
-
+
return;
} # maillog
return;
} # maillog
@@
-644,7
+645,7
@@
Returns:
$msg = "$me: " . YMDHM . ": $msg" if $self->{timestamped};
display $msg, $self->{handle}, $nolinefeed;
$msg = "$me: " . YMDHM . ": $msg" if $self->{timestamped};
display $msg, $self->{handle}, $nolinefeed;
-
+
return;
} # log
return;
} # log
@@
-685,7
+686,7
@@
Returns:
display "\$ $cmd", $self->{handle} if get_debug;
display "\$ $cmd", $self->{handle} if get_debug;
- my $status = open my $output, '|', "$cmd 2>&1";
+ my $status = open my $output, '
-
|', "$cmd 2>&1";
if (!$status) {
$self->{error}++;
if (!$status) {
$self->{error}++;
@@
-709,7
+710,7
@@
Returns:
sub loglines () {
my ($self) = @_;
sub loglines () {
my ($self) = @_;
-
+
=pod
=head3 loglines
=pod
=head3 loglines
@@
-789,7
+790,7
@@
Returns:
=cut
warning $msg, $warnno;
=cut
warning $msg, $warnno;
-
+
if ($warnno) {
$msg = "WARNING #$warnno: $msg";
} else {
if ($warnno) {
$msg = "WARNING #$warnno: $msg";
} else {
@@
-798,13
+799,13
@@
Returns:
$self->log ($msg);
$self->{warnings}++;
$self->log ($msg);
$self->{warnings}++;
-
+
return;
} # warn
sub errors () {
my ($self) = @_;
return;
} # warn
sub errors () {
my ($self) = @_;
-
+
=pod
=head3 errors ()
=pod
=head3 errors ()
@@
-842,7
+843,7
@@
Returns:
sub warnings () {
my ($self) = @_;
sub warnings () {
my ($self) = @_;
-
+
=pod
=head3 warnings ()
=pod
=head3 warnings ()
@@
-885,11
+886,11
@@
sub DESTROY () {
if ($self->{disposition} eq 'temp') {
if ($self->{errors} == 0 and
if ($self->{disposition} eq 'temp') {
if ($self->{errors} == 0 and
-
$self->{warnings} == 0) {
+ $self->{warnings} == 0) {
unlink $self->fullname;
} # if
} # if
unlink $self->fullname;
} # if
} # if
-
+
return;
} # destroy
return;
} # destroy