hierarchical log routing is now implemented in object-remote instead of log-contextual
[scpubgit/Object-Remote.git] / lib / Object / Remote / LogDestination.pm
diff --git a/lib/Object/Remote/LogDestination.pm b/lib/Object/Remote/LogDestination.pm
new file mode 100644 (file)
index 0000000..68f4bb3
--- /dev/null
@@ -0,0 +1,21 @@
+package Object::Remote::LogDestination;
+
+use Moo; 
+use Scalar::Util qw(weaken);
+
+has logger => ( is => 'ro', required => 1 );
+has subscriptions => ( is => 'ro', required => 1, default => sub { [] } ); 
+
+sub select {
+   my ($self, $router, $selector) = @_; 
+   my $subscription = $router->subscribe($self->logger, $selector); 
+   push(@{ $self->subscriptions }, $subscription);
+   return $subscription; 
+}
+
+sub connect {
+   my ($self, $router) = @_; 
+   return $self->select($router, sub { 1 });
+}
+
+1; 
\ No newline at end of file