From: Tyler Riddle Date: Fri, 14 Sep 2012 00:09:16 +0000 (-0700) Subject: update logging support for log-contextual and object-remote changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8207e5dfecb79bbf6f98ee95aea4537036936094;p=scpubgit%2FSystem-Introspector.git update logging support for log-contextual and object-remote changes --- diff --git a/bin/system-introspector b/bin/system-introspector index ece49c7..d3552ff 100755 --- a/bin/system-introspector +++ b/bin/system-introspector @@ -38,13 +38,12 @@ if (defined($debug) && ! defined($log_level)) { my $log_destination; if (defined($log_level)) { -warn "$log_level"; $log_destination = Log::Contextual::Destination->new( logger => Log::Contextual::SimpleLogger->new({ levels_upto => $log_level }), ); - $log_destination->connect(System::Introspector::Logger->get_router); - #$log_destination->connect(Log::Contextual->get_root_router); + $log_destination->connect(System::Introspector::Logger->arg_router); + #$log_destination->connect(Object::Remote::Logging->arg_router); #TODO attaching to this router does't work here because of #timming issue #$log_destination->connect(Object::Remote::Logging->get_router); diff --git a/lib/System/Introspector/Logger.pm b/lib/System/Introspector/Logger.pm index fd460a4..fa50436 100644 --- a/lib/System/Introspector/Logger.pm +++ b/lib/System/Introspector/Logger.pm @@ -1,13 +1,12 @@ -use strictures 1; - package System::Introspector::Logger; -use base qw(Log::Contextual); +use strictures 1; + use System::Introspector::Logger::Output; -use Log::Contextual qw( :log ); -use Log::Contextual::Destination; +use Object::Remote::Logging qw( :log ); +use Object::Remote::LogDestination; -sub arg_router { $_[1] || Log::Contextual::Router::Dynamic->new } +use base qw(Object::Remote::Logging); #should always pass in log level and execution context; #specifying a logger is used when logging during diff --git a/t/logger.t b/t/logger.t index b01720c..166f0e9 100644 --- a/t/logger.t +++ b/t/logger.t @@ -3,6 +3,6 @@ use Test::More; use System::Introspector::Logger qw ( :log ); -ok (System::Introspector::Logger->get_router->does('Log::Contextual::Role::Router'), 'router exists'); +ok (System::Introspector::Logger->arg_router->does('Log::Contextual::Role::Router'), 'router exists'); done_testing; \ No newline at end of file diff --git a/t/logsetup.pl b/t/logsetup.pl index 75de5e7..01c6df7 100644 --- a/t/logsetup.pl +++ b/t/logsetup.pl @@ -12,14 +12,14 @@ sub _log { } package main; -use System::Introspector::Logger qw( :log ); +use Object::Remote::Logging qw( :log ); +use Object::Remote::LogDestination; #make sure to enable execution of every logging code block #by setting the log level as high as it can go - my $____LOG_DESTINATION = Log::Contextual::Destination->new( + my $____LOG_DESTINATION = Object::Remote::LogDestination->new( logger => System::Introspector::Logger::TestOutput->new({ levels_upto => 'trace' }), ); - $____LOG_DESTINATION->connect(System::Introspector::Logger->get_root_router); - + $____LOG_DESTINATION->connect(Object::Remote::Logging->arg_router); 1;