$logtime = time();
$logcount = 0;
$logrepeat = 0;
-$logold = "";
+$logold = '';
$param{VEBOSITY} ||= 1; # lame fix for preload
$b_yellow $_yellow $b_blue $_blue $b_magenta $_magenta
$b_cyan $_cyan $b_white $_white $_reset $_bold $ob $b);
-$b_black = cl('bold black'); $_black = cl('black');
+$b_black = cl('bold black'); $_black = cl('black');
$b_red = cl('bold red'); $_red = cl('red');
$b_green = cl('bold green'); $_green = cl('green');
$b_yellow = cl('bold yellow'); $_yellow = cl('yellow');
# logging support.
sub openLog {
- return unless (&IsParam("logfile"));
+ return unless (&IsParam('logfile'));
$file{log} = $param{'logfile'};
my $error = 0;
$error++;
}
- if (&IsParam("logType") and $param{'logType'} =~ /DAILY/i) {
+ if (&IsParam('logType') and $param{'logType'} =~ /DAILY/i) {
my ($day,$month,$year) = (gmtime time())[3,4,5];
$logDate = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);
- $file{log} .= "-".$logDate;
+ $file{log} .= $logDate;
}
if (open(LOG, ">>$file{log}")) {
sub closeLog {
# lame fix for paramlogfile.
- return unless (&IsParam("logfile"));
+ return unless (&IsParam('logfile'));
return unless (defined fileno LOG);
close LOG;
# Usage: &compress($file);
sub compress {
my ($file) = @_;
- my @compress = ("/usr/bin/bzip2","/bin/gzip");
+ my @compress = ('/usr/bin/bzip2','/bin/bzip2','/bin/gzip');
my $okay = 0;
if (! -f $file) {
}
sub DEBUG {
- return unless (&IsParam("DEBUG"));
+ return unless (&IsParam('DEBUG'));
&status("${b_green}!DEBUG!$ob $_[0]");
}
}
sub WARN {
- return unless (&IsParam("WARN"));
+ return unless (&IsParam('WARN'));
return if ($_[0] =~ /^PERL: Subroutine \S+ redefined at/);
}
sub VERB {
- if (!&IsParam("VERBOSITY")) {
+ if (!&IsParam('VERBOSITY')) {
# NOTHING.
- } elsif ($param{'VERBOSITY'} eq "1" and $_[1] <= 1) {
+ } elsif ($param{'VERBOSITY'} eq '1' and $_[1] <= 1) {
&status($_[0]);
- } elsif ($param{'VERBOSITY'} eq "2" and $_[1] <= 2) {
+ } elsif ($param{'VERBOSITY'} eq '2' and $_[1] <= 2) {
&status($_[0]);
}
}
# if it's not a scalar, attempt to warn and fix.
my $ref = ref $input;
- if (defined $ref and $ref ne "") {
+ if (defined $ref and $ref ne '') {
&WARN("status: 'input' is not scalar ($ref).");
- if ($ref eq "ARRAY") {
+ if ($ref eq 'ARRAY') {
foreach (@$input) {
&WARN("status: '$_'.");
}
$status = "[$statcount] ".$input;
}
- if (&IsParam("backlog")) {
+ if (&IsParam('backlog')) {
push(@backlog, $status); # append to end.
shift(@backlog) if (scalar @backlog > $param{'backlog'});
}
- if (&IsParam("VERBOSITY")) {
+ if (&IsParam('VERBOSITY')) {
if ($statcountfix) {
printf $_red."!%6d!".$ob." ", $statcount;
} else {
}
# log the line into a file.
- return unless (&IsParam("logfile"));
+ return unless (&IsParam('logfile'));
return unless (defined fileno LOG);
# remove control characters from logging to LOGFILE.
for ($input) {
- last if (&IsParam("logColors"));
+ last if (&IsParam('logColors'));
s/\e\[[0-9;]+m//g; # escape codes.
s/[\cA-\c_]//g; # control chars.
}
$input = "FORK($$) ".$input if ($statcountfix);
my $date;
- if (&IsParam("logType") and $param{'logType'} =~ /DAILY/i) {
+ if (&IsParam('logType') and $param{'logType'} =~ /DAILY/i) {
$date = sprintf("%02d:%02d.%02d", (gmtime $time)[2,1,0]);
my ($day,$month,$year) = (gmtime $time)[3,4,5];
}
sub SQLDebug {
- return unless (&IsParam("SQLDebug"));
+ return unless (&IsParam('SQLDebug'));
return unless (fileno SQLDEBUG);