X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FRole%2FLogForwarder.pm;h=5be68513692e1b0736e016cec7d3d60470087d88;hp=3c1ef6241c683e2cb4dc83290efef525b32f0fc0;hb=6536ccd3af048ed71845cc5ea453855f45e66971;hpb=4a9fa1a5a329754549f998536e0e68f19d42d7ab diff --git a/lib/Object/Remote/Role/LogForwarder.pm b/lib/Object/Remote/Role/LogForwarder.pm index 3c1ef62..5be6851 100644 --- a/lib/Object/Remote/Role/LogForwarder.pm +++ b/lib/Object/Remote/Role/LogForwarder.pm @@ -1,7 +1,10 @@ +#This is an experimental method for working with +#Log::Contextual crossing Object::Remote connections +#transparently + package Object::Remote::Role::LogForwarder; use Moo::Role; -use Object::Remote::Logging; use Scalar::Util qw(weaken); use Carp qw(cluck); @@ -16,43 +19,46 @@ has parent_router => ( is => 'rw', );#weak_ref => 1 ); sub BUILD { } after BUILD => sub { - my ($self) = @_; -# my $parent = $self->parent_router; -# return unless defined $parent ; -# $parent->add_child_router($self); + my ($self) = @_; +# my $parent = $self->parent_router; +# return unless defined $parent ; +# $parent->add_child_router($self); }; sub describe { - my ($self, $depth) = @_; - $depth = -1 unless defined $depth; - $depth++; - my $buf = "\t" x $depth . $self->description . "\n"; - foreach my $child (@{$self->child_routers}) { - next unless defined $child; - $buf .= $child->describe($depth); - } + my ($self, $depth) = @_; + $depth = -1 unless defined $depth; + $depth++; + my $buf = "\t" x $depth . $self->description . "\n"; + foreach my $child (@{$self->child_routers}) { + next unless defined $child; + $buf .= $child->describe($depth); + } - return $buf; + return $buf; } sub add_child_router { - my ($self, $router) = @_; - push(@{ $self->child_routers }, $router); + my ($self, $router) = @_; + push(@{ $self->child_routers }, $router); + #TODO re-weaken when object::remote proxied + #weak references is figured out # weaken(${ $self->child_routers }[-1]); - return; + return; } #sub remove_child_router { -# my ($self, $description) = @_; -# return delete $self->child_routers->{$description}; +# my ($self, $description) = @_; +# return delete $self->child_routers->{$description}; #} -after handle_log_message => sub { - my ($self, @args) = @_; - my $parent = $self->parent_router; +after get_loggers => sub { + my ($self, @args) = @_; + my $parent = $self->parent_router; - return unless defined $parent; - $parent->handle_log_message(@args); + return unless defined $parent; + $parent->handle_log_message(@args); }; 1; +