3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00

Print IRC debug messages to STDERR

This commit is contained in:
Pragmatic Software 2015-02-15 20:19:51 -08:00
parent ec13cf14bc
commit 1ffe857ba5
2 changed files with 15 additions and 11 deletions

View File

@ -499,12 +499,12 @@ sub handler {
croak "Not enough arguments to handler()";
}
print "Trying to handle event '$ev'.\n" if $self->{_debug};
print STDERR "Trying to handle event '$ev'.\n" if $self->{_debug};
if($self->{_debug}) {
use Data::Dumper;
print "ev: ", Dumper($ev), "\nevent: ", Dumper($event), "\n";
print STDERR "ev: ", Dumper($ev), "\nevent: ", Dumper($event), "\n";
}
my $handler = undef;
@ -531,7 +531,7 @@ sub handler {
confess "Bad parameter passed to handler(): rp=$rp";
}
print "Handler for '$ev' called.\n" if $self->{_debug};
print STDERR "Handler for '$ev' called.\n" if $self->{_debug};
return 1;
}
@ -895,7 +895,7 @@ sub parse {
$line =~ s/[\012\015]+$//;
next unless $line;
print "<<< $line\n" if $self->{_debug};
print STDERR "<<< $line\n" if $self->{_debug};
# Like the RFC says: "respond as quickly as possible..."
if ($line =~ /^PING/) {
@ -935,7 +935,7 @@ sub parse {
# ($from, $line) = split ":", $line, 2;
($from, $line) = $line =~ /^(?:|)(\S+\s+[^:]+):?(.*)/;
print "from: [$from], line: [$line]\n" if $self->{_debug};
print STDERR "from: [$from], line: [$line]\n" if $self->{_debug};
($from, $type, @stuff) = split /\s+/, $from;
$type = lc $type;
@ -1309,6 +1309,7 @@ sub schedule {
croak 'Second argument to schedule() isn\'t a coderef';
}
print STDERR "Scheduling event with time [$time]\n";
$time += time;
$self->parent->enqueue_scheduled_event($time, $coderef, $self, @_);
}
@ -1325,6 +1326,7 @@ sub schedule_output_event {
croak 'Second argument to schedule() isn\'t a coderef';
}
print STDERR "Scheduling output event with time [$time]\n";
$time += time;
$self->parent->enqueue_output_event($time, $coderef, $self, @_);
}
@ -1400,9 +1402,11 @@ sub sl {
### DEBUG DEBUG DEBUG
if ($self->{_debug}) {
print "S-> $seconds $line\n";
print STDERR "S-> $seconds $line\n";
}
print STDERR "S-> $seconds $line\n";
$self->schedule_output_event($seconds, \&sl_real, $line);
}
@ -1420,7 +1424,7 @@ sub sl_real {
### DEBUG DEBUG DEBUG
if ($self->{_debug}) {
print ">>> $line\n";
print STDERR ">>> $line\n";
}
return unless defined $self->socket;

View File

@ -95,11 +95,11 @@ sub args {
sub dump {
my ($self, $arg, $counter) = (shift, undef, 0); # heh heh!
printf "TYPE: %-30s FORMAT: %-30s\n", $self->type, $self->format;
print "FROM: ", $self->from, "\n";
print "TO: ", join(", ", @{$self->to}), "\n";
printf STDERR "TYPE: %-30s FORMAT: %-30s\n", $self->type, $self->format;
print STDERR "FROM: ", $self->from, "\n";
print STDERR "TO: ", join(", ", @{$self->to}), "\n";
foreach $arg ($self->args) {
print "Arg ", $counter++, ": ", $arg, "\n";
print STDERR "Arg ", $counter++, ": ", $arg, "\n";
}
}