start adding logs and add support for routed logs and logging to stderr
[scpubgit/Object-Remote.git] / lib / Object / Remote / LogDestination.pm
CommitLineData
f7ea4120 1package Object::Remote::LogDestination;
2
3use Moo;
4use Scalar::Util qw(weaken);
5
6has logger => ( is => 'ro', required => 1 );
7has subscriptions => ( is => 'ro', required => 1, default => sub { [] } );
8
9sub select {
10 my ($self, $router, $selector) = @_;
11 my $subscription = $router->subscribe($self->logger, $selector);
12 push(@{ $self->subscriptions }, $subscription);
13 return $subscription;
14}
15
16sub connect {
17 my ($self, $router) = @_;
18 return $self->select($router, sub { 1 });
19}
20
4a9fa1a5 211;
22
23