From: Tyler Riddle Date: Mon, 14 Jan 2013 22:11:47 +0000 (-0800) Subject: update logging api to match log-contextual 0.005 X-Git-Tag: v0.003001_01~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=572a9a00cec239943f92157ec39c44398aad137f;p=scpubgit%2FObject-Remote.git update logging api to match log-contextual 0.005 --- diff --git a/Makefile.PL b/Makefile.PL index f3c9a27..4e934be 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -14,6 +14,7 @@ WriteMakefile( 'CPS::Future' => 0, 'Class::C3' => 0, # required to fatpack Moo 'String::ShellQuote' => 0, # required for ssh argument manipulation + 'Log::Contextual' => 0.005000 }, EXE_FILES => [ 'bin/object-remote-node', diff --git a/lib/Object/Remote/Logging/Router.pm b/lib/Object/Remote/Logging/Router.pm index 46b6da7..15bd251 100644 --- a/lib/Object/Remote/Logging/Router.pm +++ b/lib/Object/Remote/Logging/Router.pm @@ -17,7 +17,7 @@ sub after_import { } sub _get_loggers { my ($self, %metadata) = @_; my $package = $metadata{caller_package}; - my $level = $metadata{log_level}; + my $level = $metadata{message_level}; my $is_level = "is_$level"; my $need_clean = 0; my @loggers; @@ -62,7 +62,7 @@ sub _deliver_message { my @loggers = $self->_get_loggers(%message_info); my $generator = $message_info{message_sub}; my $args = $message_info{message_args}; - my $level = $message_info{log_level}; + my $level = $message_info{message_level}; return unless @loggers > 0; #this is the point where the user provided log message code block is executed @@ -74,7 +74,7 @@ sub _deliver_message { sub handle_log_request { my ($self, %message_info) = @_; - my $level = $message_info{log_level}; + my $level = $message_info{message_level}; my $package = $message_info{caller_package}; my $need_clean = 0; diff --git a/t/logrouter.t b/t/logrouter.t index 4a486cd..f4408a1 100644 --- a/t/logrouter.t +++ b/t/logrouter.t @@ -11,7 +11,7 @@ my $generator = sub { "Generator output" }; my %metadata = ( exporter => $controller_name, caller_package => __PACKAGE__, caller_level => 0, - log_level => 'test1', message_sub => $generator, message_args => [], + message_level => 'test1', message_sub => $generator, message_args => [], ); my $router = Object::Remote::Logging::Router->new; @@ -37,7 +37,7 @@ is(ref $logger->feedback_input->[2]->{message_sub}, 'CODE', 'message sub did exi delete $logger->feedback_input->[2]->{message_sub}; is_deeply($logger->feedback_input, [ 'test1', [ 'Generator output' ], { - exporter => 'Test::Log::Controller', log_level => 'test1', + exporter => 'Test::Log::Controller', message_level => 'test1', hostname => hostname(), pid => $$, caller_package => __PACKAGE__, line => $linenum, method => undef, filename => __FILE__, message_args => [], object_remote => {