1 package Object::Remote::Role::LogForwarder;
5 with 'Log::Contextual::Role::Router';
7 #TODO re-weaken router references when object::remote
8 #weak reference operation is figured out
10 has child_routers => ( is => 'ro', required => 1, default => sub { {} } );
11 has parent_router => ( is => 'rw', );#weak_ref => 1 );
13 #adds a child router to this router and gives it
14 #a friendly display name
15 sub add_child_router {
16 my ($self, $description, $router) = @_;
17 $self->child_routers->{$description} = $router;
18 #weaken($self->child_routers->{$class});
19 $router->parent_router($self);
23 sub remove_child_router {
24 my ($self, $description) = @_;
25 return delete $self->child_routers->{$description};
28 after handle_log_message => sub {
29 my ($self, @args) = @_;
30 my $parent = $self->parent_router;
32 return unless defined $parent;
33 $parent->handle_log_message(@args);