[svk-commit] r2418 - branches/svk-logger/lib/SVK/Command

nobody at bestpractical.com nobody at bestpractical.com
Thu Jun 28 22:13:04 EDT 2007


Author: clsung
Date: Thu Jun 28 22:13:04 2007
New Revision: 2418

Modified:
   branches/svk-logger/lib/SVK/Command/List.pm
   branches/svk-logger/lib/SVK/Command/Propget.pm

Log:
- modify patternlayout in these two modules
  my $origlayout = $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout;
  my $verbatimlayout = Log::Log4perl::Layout::PatternLayout->new("%m");
  $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout($verbatimlayout);
  ... modified parts ...
  $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout($origlayout);
- there should be a better solution...

Modified: branches/svk-logger/lib/SVK/Command/List.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/List.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/List.pm	Thu Jun 28 22:13:04 2007
@@ -103,6 +103,9 @@
 sub _print_item {
     my ( $self, $target, $kind, $level, $enc ) = @_;
     my $root = $target->root;
+    my $origlayout = $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout;
+    my $verbatimlayout = Log::Log4perl::Layout::PatternLayout->new("%m");
+    $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout($verbatimlayout);
     if ( $self->{verbose} ) {
         my $rev = $root->node_created_rev( $target->path );
         my $fs  = $target->repos->fs;
@@ -124,13 +127,13 @@
         $output_path = $target->report;
     }
     else {
-        $logger->info( " " x ($level-1) ) unless $level == 1;
+        $logger->info( " " x ($level-1) );
         $output_path = Path::Class::File->new_foreign( 'Unix', $target->path )
             ->basename;
     }
     to_native( $output_path, 'path', $enc );
-    $logger->info( $output_path. ( $kind == $SVN::Node::dir ? '/' : '' ) . "\n" );
-
+    $logger->info( $output_path. ( $kind == $SVN::Node::dir ? '/' : '' ) . "\n");
+    $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout($origlayout);
 }
 
 1;

Modified: branches/svk-logger/lib/SVK/Command/Propget.pm
==============================================================================
--- branches/svk-logger/lib/SVK/Command/Propget.pm	(original)
+++ branches/svk-logger/lib/SVK/Command/Propget.pm	Thu Jun 28 22:13:04 2007
@@ -81,10 +81,14 @@
             my $proplist = $self->_proplist($target);
             exists $proplist->{$pname} or return;
 
+            my $origlayout = $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout;
+            my $verbatimlayout = Log::Log4perl::Layout::PatternLayout->new("%m");
+            $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout($verbatimlayout);
             $logger->info( $target->report, ' - ')
                 if !$self->{strict} && ( $self->{recursive} || @targets > 1 );
             $logger->info( $proplist->{$pname});
             $logger->info( "\n" )if !$self->{strict};
+            $Log::Log4perl::Logger::APPENDER_BY_NAME{'Screen'}->layout($origlayout);
         }, $errs, 0,
     ) for @targets;
 


More information about the svk-commit mailing list