From: Tyler Riddle Date: Sat, 1 Dec 2012 01:56:38 +0000 (-0800) Subject: set log forwarding to be enabled by default X-Git-Tag: v0.003001_01~53 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=commitdiff_plain;h=09f583a745c0bfefad33d22faefcf8dc4335a934;hp=e1a0b9ca22fab8555fb597473b6f3a4074d7b48b set log forwarding to be enabled by default --- diff --git a/lib/Object/Remote/Logging.pm b/lib/Object/Remote/Logging.pm index e4e740e..df4134f 100644 --- a/lib/Object/Remote/Logging.pm +++ b/lib/Object/Remote/Logging.pm @@ -71,8 +71,12 @@ sub init_logging { my $format = $ENV{OBJECT_REMOTE_LOG_FORMAT}; my $selections = $ENV{OBJECT_REMOTE_LOG_SELECTIONS}; my %controller_should_log; + + unless (defined $ENV{OBJECT_REMOTE_LOG_FORWARDING} && $ENV{OBJECT_REMOTE_LOG_FORWARDING} ne '') { + $ENV{OBJECT_REMOTE_LOG_FORWARDING} = 1; + } - return unless defined $level; + return unless defined $level && $level ne ''; $format = "[%l %r] %s" unless defined $format; $selections = __PACKAGE__ unless defined $selections; %controller_should_log = _parse_selections($selections); @@ -136,7 +140,7 @@ Object::Remote::Logging - Logging subsystem for Object::Remote $ENV{OBJECT_REMOTE_LOG_FORMAT} = '%l %t: %p::%m %s'; #and more $ENV{OBJECT_REMOTE_LOG_SELECTIONS} = 'Object::Remote::Logging Some::Other::Subclass'; $ENV{OBJECT_REMOTE_LOG_SELECTIONS} = '* -Object::Remote::Logging'; - $ENV{OBJECT_REMOTE_LOG_FORWARDING} = 1; #default 0 + $ENV{OBJECT_REMOTE_LOG_FORWARDING} = 0; #default 1 log_info { 'Trace log event' }; Dlog_verbose { "Debug event with Data::Dumper::Concise: $_" } { foo => 'bar' }; @@ -195,8 +199,8 @@ remote interpreter and the logger for the message is invoked in the local interp Sub-classes of Object::Remote::Logging will have log messages forwarded automatically. Loggers receive forwarded log messages exactly the same way as non-forwarded messages except a forwarded message includes extra metadata about the remote interpreter. Log -forwarding is not currently enabled by default; to enable it set the -OBJECT_REMOTE_LOG_FORWARDING environment variable to 1. See L. +forwarding is enabled by default but comes with a performance hit; to disable it set the +OBJECT_REMOTE_LOG_FORWARDING environment variable to 0. See L. =head1 EXPORTABLE SUBROUTINES