start adding logs and add support for routed logs and logging to stderr
[scpubgit/Object-Remote.git] / lib / Object / Remote / Role / Connector / PerlInterpreter.pm
index cfa039a..d418c23 100644 (file)
@@ -5,6 +5,7 @@ use IO::Handle;
 use Object::Remote::ModuleSender;
 use Object::Remote::Handle;
 use Object::Remote::Future;
+use Object::Remote::Logging qw( :log );
 use Scalar::Util qw(blessed);
 use Moo::Role;
 
@@ -29,6 +30,8 @@ around connect => sub {
   return future {
     $f->on_done(sub {
       my ($conn) = $f->get;
+      my $sub = $conn->remote_sub('Object::Remote::Logging::init_logging_forwarding');
+      $sub->('Object::Remote::Logging', Object::Remote::Logging->arg_router);
       Object::Remote::Handle->new(
         connection => $conn,
         class => 'Object::Remote::ModuleLoader',
@@ -93,6 +96,7 @@ END
   $text .= "ENDFAT\n";
   $text .= <<'END';
 eval $Object::Remote::FatNode::DATA;
+die $@ if $@;
 END
   $text .= "__END__\n";
   return $text;