[svk-commit] r2907 - trunk/lib/SVK

nobody at bestpractical.com nobody at bestpractical.com
Fri May 30 16:57:15 EDT 2008


Author: alexmv
Date: Fri May 30 16:57:13 2008
New Revision: 2907

Modified:
   trunk/lib/SVK/Logger.pm

Log:
 * 5.10 is pickier about passing undef to lc -- guard against that.

 * Make tests pass if you don't have Log::Log4perl; they were failing
   because the compat stub didn't log all parameters passed to it,
   merely the first.  This manifested as "one less newline" in many
   cases.


Modified: trunk/lib/SVK/Logger.pm
==============================================================================
--- trunk/lib/SVK/Logger.pm	(original)
+++ trunk/lib/SVK/Logger.pm	Fri May 30 16:57:13 2008
@@ -59,8 +59,9 @@
         Log::Log4perl->import(':levels');
         1;
     } ) {
-    my $level = { map { $_ => uc $_ } qw( debug info warn error fatal ) }
-        ->{ lc $ENV{SVKLOGLEVEL} } || 'INFO';
+    my $level = lc($ENV{SVKLOGLEVEL} || "info");
+    $level = { map { $_ => uc $_ } qw( debug info warn error fatal ) }
+        ->{ $level } || 'INFO';
 
     my $conf_file = $ENV{SVKLOGCONFFILE};
     my $conf;
@@ -83,7 +84,6 @@
     # ... passed as a reference to init()
     Log::Log4perl::init( \$conf );
     *get_logger = sub { Log::Log4perl->get_logger(@_) };
-
 }
 else {
     *get_logger = sub { 'SVK::Logger::Compat' };
@@ -119,12 +119,14 @@
 BEGIN {
 my $i;
 $level = { map { $_ => ++$i } reverse qw( debug info warn error fatal ) };
-$current_level = $level->{lc $ENV{SVKLOGLEVEL}} || $level->{info};
+$current_level = $level->{lc($ENV{SVKLOGLEVEL} || "info")} || $level->{info};
 
 my $ignore  = sub { return };
 my $warn = sub {
-    print $_[1];
-    print "\n" unless substr( $_[1], -1, 1 ) eq "\n";
+    shift;
+    my $s = join "", @_;
+    chomp $s;
+    print "$s\n";
 };
 my $die     = sub { shift; die $_[0]."\n"; };
 my $carp    = sub { shift; goto \&Carp::carp };


More information about the svk-commit mailing list