From: Chris Nehren Date: Sun, 19 Aug 2012 03:21:27 +0000 (+0000) Subject: more focused debug logging X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bebe6e170cd2e37d1522b29c3be0cc736c868298;p=scpubgit%2FObject-Remote.git more focused debug logging --- diff --git a/lib/Object/Remote/Future.pm b/lib/Object/Remote/Future.pm index 23a9441..893fb6d 100644 --- a/lib/Object/Remote/Future.pm +++ b/lib/Object/Remote/Future.pm @@ -8,8 +8,6 @@ use CPS::Future; our @EXPORT = qw(future await_future await_all); -sub _log { printf "[%s] %s\n", scalar(localtime), join '', @_ } - sub future (&;$) { my $f = $_[0]->(CPS::Future->new); return $f if ((caller(1+($_[1]||0))||'') eq 'start'); @@ -20,7 +18,6 @@ our @await; sub await_future { my $f = shift; - _log(sprintf "got $f: [%s]", $f->is_ready); return $f if $f->is_ready; require Object::Remote; my $loop = Object::Remote->current_loop; diff --git a/lib/Object/Remote/MiniLoop.pm b/lib/Object/Remote/MiniLoop.pm index 3a5b763..3951bf9 100644 --- a/lib/Object/Remote/MiniLoop.pm +++ b/lib/Object/Remote/MiniLoop.pm @@ -16,8 +16,6 @@ has _write_select => (is => 'ro', default => sub { IO::Select->new }); has _timers => (is => 'ro', default => sub { [] }); -sub _log { shift; printf "[%s] %s\n", scalar(localtime), join '', @_ } - sub pass_watches_to { my ($self, $new_loop) = @_; foreach my $fh ($self->_read_select->handles) { @@ -92,7 +90,6 @@ sub loop_once { # differentiate between an error and a timeout. # -- no, love, mst. foreach my $fh (@$readable) { - $self->_log("got a readable: $fh"); $read->{$fh}() if $read->{$fh}; } foreach my $fh (@$writeable) { diff --git a/lib/Object/Remote/ReadChannel.pm b/lib/Object/Remote/ReadChannel.pm index 84b3270..2607373 100644 --- a/lib/Object/Remote/ReadChannel.pm +++ b/lib/Object/Remote/ReadChannel.pm @@ -25,6 +25,8 @@ has on_line_call => (is => 'rw'); has _receive_data_buffer => (is => 'ro', default => sub { my $x = ''; \$x }); +sub _log { shift; printf "[%s] %s\n", scalar(localtime), join '', @_ } + sub _receive_data_from { my ($self, $fh) = @_; my $rb = $self->_receive_data_buffer; @@ -41,6 +43,7 @@ sub _receive_data_from { on_read_ready => 1 ); $self->on_close_call->($err); + $self->_log(sprintf "!!!!!Closing %s due to $err!!!!!\n\n\n\n\n", $self->fh); } }