use strict;
use vars qw($statcount $bot_pid $forkedtime $statcountfix $addressed);
-use vars qw($logDate $logold $logcount $logtime $logrepeat);
+use vars qw($logDate $logold $logcount $logtime $logrepeat $running);
use vars qw(@backlog);
-use vars qw(%param %file);
+use vars qw(%param %file %cache);
require 5.001;
&status("Opened logfile $file{log}.");
LOG->autoflush(1);
} else {
- &status("cannot open logfile $file{log}; not logging.");
+ &status("Cannot open logfile ($file{log}); not logging: $!");
}
}
my($input) = @_;
my $status;
+ # a way to hook onto status without looping.
+ # todo: find why $channels{undef} is created.
+ if (0 and $running and !$cache{statusSafe}) {
+ &ircCheck();
+ }
+
if ($input eq $logold) {
# allow perl flooding
$logrepeat++ unless ($input =~ /PERL: Use of uninitialized/);
if ($logrepeat >= 3) {
$logrepeat = 0;
&status("LOG: repeat throttle.");
+ # we block it to ensure sequence of logging is intact.
+ # could go with $conn->schedule but that's evil :)
sleep 1;
}
} else {
# Something is using this w/ NULL.
if (!defined $input or $input =~ /^\s*$/) {
- $input = "Blank status call? HELP HELP HELP";
+ $input = "ERROR: Blank status call? HELP HELP HELP";
}
for ($input) {
s/\n+$//;
- s/\n/<NL>/g;
s/\002|037//g; # bold,video,underline => remove.
}
+ # does this work?
+ if ($input =~ /\n/) {
+ foreach (split(/\n/, $input)) {
+ &status($_);
+ }
+ }
+
# pump up the stats.
$statcount++;
if (&IsParam("VERBOSITY")) {
if ($statcountfix) {
- printf $_red."!%5d!".$ob." ", $statcount;
+ printf $_red."!%6d!".$ob." ", $statcount;
} else {
- printf $_green."[%5d]".$ob." ", $statcount;
+ printf $_green."[%6d]".$ob." ", $statcount;
}
- # three uberstabs to Derek Moeller.
+ # three uberstabs to Derek Moeller. I don't remember why but he
+ # deserved it :)
my $printable = $input;
if ($printable =~ s/^(<\/\S+>) //) {
my $newlogDate = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);
if (defined $logDate and $newlogDate != $logDate) {
&closeLog();
- &compress($file{log});
+ &compress( $file{log} );
&openLog();
}
} else {
$date = $time;
}
- print LOG sprintf("%s %s\n", $date, $input);
+ printf LOG "%s %s\n", $date, $input;
}
sub openSQLDebug {
if (!open(SQLDEBUG, ">>$param{'SQLDebug'}")) {
- &ERROR("cannot open $param{'SQLDebug'}...");
+ &ERROR("Cannot open ($param{'SQLDebug'}): $!");
delete $param{'SQLDebug'};
return 0;
}
&status("Closed SQL Debug file: $param{'SQLDebug'}");
}
+sub SQLDebug {
+ return unless (&IsParam("SQLDebug"));
+
+ return unless (fileno SQLDEBUG);
+
+ print SQLDEBUG $_[0]."\n";
+}
+
1;