sub _create_format_lookup {
my ($self, $level, $metadata, $content) = @_;
+ my $method = $metadata->{method};
+
+ $method = '(none)' unless defined $method;
+
return {
'%' => '%', t => $self->_render_time($metadata->{timestamp}),
r => $self->_render_remote($metadata->{object_remote}),
s => $self->_render_log(@$content), l => $level,
- p => $metadata->{package}, m => $metadata->{method},
+ p => $metadata->{package}, m => $method,
f => $metadata->{filename}, i => $metadata->{line},
};
package Object::Remote::Logging::Router;
use Moo;
+use Scalar::Util qw(weaken);
with 'Log::Contextual::Role::Router';
with 'Object::Remote::Role::LogForwarder';
@caller_info = caller($caller_level + 1);
$metadata{method} = $caller_info[3];
- $metadata{method} =~ s/^${package}:://;
+ $metadata{method} =~ s/^${package}::// if defined $metadata{method};
foreach my $logger ($self->_get_loggers(%metadata)) {
$logger->$level([ $generator->(@args) ], \%metadata);
}
push(@{$self->_connections}, $wrapped);
+ weaken($self->_connections->[-1]);
}
sub _clean_connections {