X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FLogging.pm;h=1c239a7b556dbdbfd51c434a1fc8ec95defe23ce;hp=f765db8696002c9c5c9f0be12eb641e22ef584aa;hb=c0b2df05c2f912c9ad4fb0642c95334564ca84ec;hpb=b49a063d7885c23278585e52c3066c791f8934f2 diff --git a/lib/Object/Remote/Logging.pm b/lib/Object/Remote/Logging.pm index f765db8..1c239a7 100644 --- a/lib/Object/Remote/Logging.pm +++ b/lib/Object/Remote/Logging.pm @@ -7,33 +7,33 @@ use Object::Remote::Logging::Logger; extends 'Log::Contextual'; sub router { - our $Router_Instance ||= do { - require Object::Remote::Logging::Router; - Object::Remote::Logging::Router->new; - } + our $Router_Instance ||= do { + require Object::Remote::Logging::Router; + Object::Remote::Logging::Router->new; + } } sub arg_levels { - return [qw( trace debug verbose info warn error )]; + return [qw( trace debug verbose info warn error )]; } #this is invoked on all nodes sub init_logging { - my $level = $ENV{OBJECT_REMOTE_LOG_LEVEL}; - return unless defined $level; - my $logger = Object::Remote::Logging::Logger->new( - min_level => lc($level), - level_names => Object::Remote::Logging::arg_levels(), - ); - - #TODO check on speed of string compare against a hash with a single key - router()->connect(sub { - return unless $_[1]->{controller} eq __PACKAGE__; - #skip things from remote hosts because they log to STDERR - #when OBJECT_REMOTE_LOG_LEVEL is in effect - return if $_[1]->{remote}->{connection_id}; - $logger - }); + my $level = $ENV{OBJECT_REMOTE_LOG_LEVEL}; + return unless defined $level; + my $logger = Object::Remote::Logging::Logger->new( + min_level => lc($level), + level_names => Object::Remote::Logging::arg_levels(), + ); + + #TODO check on speed of string compare against a hash with a single key + router()->connect(sub { + return unless $_[1]->{controller} eq __PACKAGE__; + #skip things from remote hosts because they log to STDERR + #when OBJECT_REMOTE_LOG_LEVEL is in effect + return if $_[1]->{remote}->{connection_id}; + $logger + }); } #this is invoked by the controlling node