router()->connect(sub {
my $controller = $_[1]->{controller};
my $will_log = $controller_should_log{$controller};
+ my $remote_info = $_[1]->{object_remote};
$will_log = $controller_should_log{'*'} unless defined $will_log;
return unless $will_log;
#skip things from remote hosts because they log to STDERR
#when OBJECT_REMOTE_LOG_LEVEL is in effect
- return if $_[1]->{remote}->{object_remote};
- $logger
+ return if $remote_info->{forwarded};
+ return $logger;
});
}
my ($self, $level, $generator, $args, $metadata) = @_;
my $package = $metadata->{package};
my $destination = $self->_forward_destination;
+ my %metadata = %$metadata;
our $reentrant;
+
+ if (defined $metadata->{object_remote}) {
+ $metadata{object_remote} = { %{$metadata->{object_remote}} };
+ }
+
+ $metadata{object_remote}->{forwarded} = 1;
return unless $self->enable_forward;
return unless defined $destination;
local $reentrant = $package;
- eval { $destination->_deliver_message($level, $generator, $args, $metadata) };
+ eval { $destination->_deliver_message($level, $generator, $args, \%metadata) };
if ($@ && $@ !~ /^Attempt to use Object::Remote::Proxy backed by an invalid handle/) {
die $@;