[svk-commit] r2177 - in trunk: . lib/SVK lib/SVK/Command lib/SVK/Editor lib/SVK/Help lib/SVK/Resolve

stig at bestpractical.com stig at bestpractical.com
Sat Nov 18 17:46:13 EST 2006


Author: stig
Date: Sat Nov 18 17:46:12 2006
New Revision: 2177

Added:
   trunk/lib/SVK/Logger.pm
Modified:
   trunk/   (props changed)
   trunk/MANIFEST
   trunk/Makefile.PL
   trunk/lib/SVK/Command.pm
   trunk/lib/SVK/Command/Cmerge.pm
   trunk/lib/SVK/Command/Commit.pm
   trunk/lib/SVK/Command/Copy.pm
   trunk/lib/SVK/Command/Log.pm
   trunk/lib/SVK/Command/Mirror.pm
   trunk/lib/SVK/Command/Patch.pm
   trunk/lib/SVK/Command/Propset.pm
   trunk/lib/SVK/Command/Revert.pm
   trunk/lib/SVK/Command/Smerge.pm
   trunk/lib/SVK/Command/Sync.pm
   trunk/lib/SVK/Command/Update.pm
   trunk/lib/SVK/Editor/Copy.pm
   trunk/lib/SVK/Editor/Merge.pm
   trunk/lib/SVK/Editor/Status.pm
   trunk/lib/SVK/Help/Environment.pod
   trunk/lib/SVK/Merge.pm
   trunk/lib/SVK/Mirror.pm
   trunk/lib/SVK/Patch.pm
   trunk/lib/SVK/Path.pm
   trunk/lib/SVK/Path/View.pm
   trunk/lib/SVK/Resolve.pm
   trunk/lib/SVK/Resolve/Emacs.pm
   trunk/lib/SVK/Test.pm
   trunk/lib/SVK/Util.pm
   trunk/lib/SVK/XD.pm

Log:
Add SVK::Logger. Using it imports a configured Log::Log4perl object called
$logger[0] into your namespace. A lot of debugging that previously used "warn
'foo' if $main::DEBUG" has been converted to use this framework. You can get
debugging output by setting the SVKLOGLEVEL environment variable to 'debug' (it
is case insensitive). Also, quite a bit of the normal chatter from svk has been
converted too, so you can make svk be quieter by setting SVKLOGLEVEL to 'warn'.

[0] you can change the name of the variable by giving an argument to import,
but try not to.
 r2140 at figleaf (orig r2137):  stig | 2006-11-14 20:40:17 +0000
 how about a logging framework? would that be something?
 r2141 at figleaf (orig r2138):  stig | 2006-11-14 21:36:37 +0000
 add logging module
 r2142 at figleaf (orig r2139):  stig | 2006-11-15 00:44:59 +0000
 export a logger object; needs configuration still
 r2143 at figleaf (orig r2140):  clkao | 2006-11-15 14:05:36 +0000
 transform caller for actual logger name.
 r2144 at figleaf (orig r2141):  stig | 2006-11-15 15:27:19 +0000
 added a small config section
 r2145 at figleaf (orig r2142):  stig | 2006-11-15 17:44:32 +0000
 * log to stdout for now
 * converted SVK::XD to use SVK::Logger
 r2146 at figleaf (orig r2143):  stig | 2006-11-15 18:24:19 +0000
 2nd pass converting SVK::XD
 r2147 at figleaf (orig r2144):  stig | 2006-11-15 18:58:17 +0000
 convert more "print loc" to use svk::logger instead
 r2149 at figleaf (orig r2146):  stig | 2006-11-16 10:45:58 +0000
 * convert a bunch of warn "..." if $main::DEBUG to use $logger->debug("...") instead.
 * Also, you can now change the logging level by setting the SVKDEBUG variable 
   (should this be SVKLOGGING instead?) to one of: debug, info, warn, error, fatal 
   (but not all of those are used yet)
 r2150 at figleaf (orig r2147):  stig | 2006-11-16 11:35:17 +0000
 rename the variable used for controlling the loglevel, and document it in the environment help page
 r2155 at figleaf (orig r2151):  stig | 2006-11-16 16:32:46 +0000
 use SVK::Logger a few more places.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Sat Nov 18 17:46:12 2006
@@ -99,6 +99,7 @@
 lib/SVK/Inspector.pm
 lib/SVK/Inspector/Compat.pm
 lib/SVK/Inspector/Root.pm
+lib/SVK/Logger.pm
 lib/SVK/Log/ChangedPath.pm
 lib/SVK/Log/ChangedPaths.pm
 lib/SVK/Log/Filter.pm

Modified: trunk/Makefile.PL
==============================================================================
--- trunk/Makefile.PL	(original)
+++ trunk/Makefile.PL	Sat Nov 18 17:46:12 2006
@@ -27,6 +27,7 @@
     'Class::Autouse'           => '1.15',
     'App::CLI'                 => '0',
     'List::MoreUtils'          => '0',
+    'Log::Log4perl'            => '0',
     'Class::Accessor::Fast'    => '0',
     'Class::Data::Inheritable' => '0',
     'Path::Class'              => '0.15',

Modified: trunk/lib/SVK/Command.pm
==============================================================================
--- trunk/lib/SVK/Command.pm	(original)
+++ trunk/lib/SVK/Command.pm	Sat Nov 18 17:46:12 2006
@@ -4,6 +4,7 @@
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use Getopt::Long qw(:config no_ignore_case bundling);
 
+use SVK::Logger;
 use SVK::Util qw( get_prompt abs2rel abs_path is_uri catdir bsd_glob from_native
 		  find_svm_source $SEP IS_WIN32 catdepot traverse_history);
 use SVK::I18N;
@@ -369,7 +370,7 @@
     # this is going to take a while, release giant lock
     $self->{xd}->giant_unlock;
 
-    print loc("New URI encountered: %1\n", $uri);
+    $logger->info(loc("New URI encountered: %1\n", $uri));
 
     my $depots = join('|', map quotemeta, sort keys %$map);
     my ($base_uri, $rel_uri);
@@ -1002,7 +1003,7 @@
 
 	my $target = $self->arg_depotpath ($path);
 	last if $allow_exist or $target->root->check_path ($target->path) == $SVN::Node::none;
-	print loc ("Path %1 already exists.\n", $path);
+	$logger->warn(loc ("Path %1 already exists.", $path));
     }
 
     return $path;

Modified: trunk/lib/SVK/Command/Cmerge.pm
==============================================================================
--- trunk/lib/SVK/Command/Cmerge.pm	(original)
+++ trunk/lib/SVK/Command/Cmerge.pm	Sat Nov 18 17:46:12 2006
@@ -5,6 +5,7 @@
 use base qw( SVK::Command::Merge SVK::Command::Copy SVK::Command::Propset );
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 use SVK::Editor::Combine;
 use SVK::Inspector::Compat;
 
@@ -29,8 +30,8 @@
     if ($0 =~ /svk$/) { 
         # Only warn about deprecation if the user is running svk. 
         # (Don't warn when running tests)                 
-        print loc("%1 cmerge is deprecated, pending improvements to the Subversion API",$0) ."\n";
-        print loc("'Use %1 merge -c' to obtain similar functionality.",$0)."\n\n";
+        $logger->warn(loc("%1 cmerge is deprecated, pending improvements to the Subversion API",$0));
+        $logger->warn(loc("'Use %1 merge -c' to obtain similar functionality.",$0)."\n");
     }
     my @revlist = $self->parse_revlist($src);
     for my $r (@revlist) {
@@ -61,8 +62,8 @@
     my $inspector = SVK::Inspector::Compat->new({$ceditor->callbacks});
     for (@revlist) {
 	my ($fromrev, $torev) = @$_;
-	print loc("Merging with base %1 %2: applying %3 %4:%5.\n",
-		  @{$base}{qw/path revision/}, $src->{path}, $fromrev, $torev);
+	$logger->info(loc("Merging with base %1 %2: applying %3 %4:%5.",
+		  @{$base}{qw/path revision/}, $src->{path}, $fromrev, $torev));
 
 	SVK::Merge->new (%$self, repos => $repos,
 			 base => $src->new (revision => $fromrev),
@@ -80,7 +81,7 @@
 				    ('file://' . $src->depot->repospath,
 				     $tmpbranch,
 				     $ENV{USER}, "merge $self->{chgspec} from $src->{path}",
-				     sub { print loc("Committed revision %1.\n", $_[0]) })
+				     sub { $logger->info(loc("Committed revision %1.", $_[0])) })
 				  ]),
 		      $fs->youngest_rev);
     my $newrev = $fs->youngest_rev;

Modified: trunk/lib/SVK/Command/Commit.pm
==============================================================================
--- trunk/lib/SVK/Command/Commit.pm	(original)
+++ trunk/lib/SVK/Command/Commit.pm	Sat Nov 18 17:46:12 2006
@@ -5,6 +5,7 @@
 use constant opt_recursive => 1;
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 use SVK::Editor::Status;
 use SVK::Editor::Sign;
 use SVK::Editor::Dynamic;
@@ -126,7 +127,7 @@
     local $@;
     my ($fh, $file) = tmpfile ('commit', DIR => '', TEXT => 1, UNLINK => 0);
     print $fh $self->{message};
-    print loc ("Commit message saved in %1.\n", $file);
+    $logger->warn(loc ("Commit message saved in %1.", $file));
 }
 
 # Return the editor according to copath, path, and is_mirror (path)
@@ -136,7 +137,7 @@
     require SVK::Patch;
     my ($m);
     if (($m) = $target->is_mirrored) {
-	print loc("Patching locally against mirror source %1.\n", $m->url);
+	$logger->info(loc("Patching locally against mirror source %1.", $m->url));
     }
     die loc ("Illegal patch name: %1.\n", $self->{patch})
 	if $self->{patch} =~ m!/!;
@@ -165,7 +166,7 @@
     my ($self, $callback) = @_;
 
     return sub {
-	print loc("Committed revision %1.\n", $_[0]);
+	$logger->info(loc("Committed revision %1.", $_[0]));
 	$callback->(@_) if $callback,
     }
 }
@@ -180,13 +181,13 @@
         && !$self->{direct}
         && ( my $m = $target->is_mirrored ) ) {
         if ( $self->{check_only} ) {
-            print loc( "Checking locally against mirror source %1.\n", $m->url )
+            $logger->info(loc( "Checking locally against mirror source %1.", $m->url ))
 		unless $self->{incremental};
         }
         else {
-            print loc("Commit into mirrored path: merging back directly.\n")
+            $logger->warn(loc("Commit into mirrored path: merging back directly."))
                 if ref($self) eq __PACKAGE__;    # XXX: output compat
-            print loc( "Merging back to mirror source %1.\n", $m->url );
+            $logger->info(loc( "Merging back to mirror source %1.", $m->url ));
         }
     }
     else {
@@ -552,14 +553,14 @@
     $self->{xd}->checkout_delta
 	( $target->for_checkout_delta,
 	  depth => $self->{recursive} ? undef : 0,
-	  debug => $main::DEBUG,
+	  debug => $logger->is_debug(),
 	  xdroot => $xdroot,
 	  editor => $editor,
 	  send_delta => !$cb{send_fulltext},
 	  nodelay => $cb{send_fulltext},
 	  $self->exclude_mirror ($target),
-	  cb_exclude => sub { print loc ("%1 is a mirrored path, please commit separately.\n",
-					 abs2rel ($_[1], $target->copath => $target->report)) },
+	  cb_exclude => sub { $logger->error(loc ("%1 is a mirrored path, please commit separately.",
+					 abs2rel ($_[1], $target->copath => $target->report))) },
 	  $self->{import} ?
 	  ( auto_add => 1,
 	    obstruct_as_replace => 1,

Modified: trunk/lib/SVK/Command/Copy.pm
==============================================================================
--- trunk/lib/SVK/Command/Copy.pm	(original)
+++ trunk/lib/SVK/Command/Copy.pm	Sat Nov 18 17:46:12 2006
@@ -4,6 +4,7 @@
 use base qw( SVK::Command::Mkdir );
 use SVK::Util qw( get_anchor get_prompt abs2rel splitdir is_uri make_path );
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ($_[0]->SUPER::options,
@@ -154,7 +155,7 @@
     return loc("Different depots.\n") unless $dst->same_repos(@src);
     my $m = $self->under_mirror($dst);
     if ( $m && !$dst->same_source(@src) ) {
-        print loc("You are trying to copy across different mirrors.\n");
+        $logger->error(loc("You are trying to copy across different mirrors."));
         die loc( "Create an empty directory %1, and run smerge --baseless %2 %3.\n",
             $dst->report, $src[0]->report, $dst->report )
           if $#src == 0 && $dst->isa('SVK::Path');
@@ -179,7 +180,7 @@
 		    die loc("Invalid argument: copying directory %1 into itself.\n", $_->report);
 		}
 		if ($_->path_anchor eq $cpdst->path_anchor) {
-		    print loc("Ignoring %1 as source.\n", $_->report);
+		    $logger->warn(loc("Ignoring %1 as source.", $_->report));
 		    next;
 		}
 		$cpdst->descend ($_->path_anchor =~ m|/([^/]+)/?$|)

Modified: trunk/lib/SVK/Command/Log.pm
==============================================================================
--- trunk/lib/SVK/Command/Log.pm	(original)
+++ trunk/lib/SVK/Command/Log.pm	Sat Nov 18 17:46:12 2006
@@ -7,6 +7,7 @@
 use SVK::I18N;
 use SVK::Util qw( traverse_history get_encoding reformat_svn_date );
 use List::Util qw(max min);
+use SVK::Logger;
 
 sub options {
     (
@@ -57,7 +58,7 @@
     # establish the output argument (presentation filter)
     my ( $presentation_filter, $filter_xml ) = @{$self}{qw/present_filter xml/};
     if ($filter_xml) {
-        print loc("Ignoring --output $presentation_filter. Using --xml.\n")
+        $logger->warn(loc("Ignoring --output $presentation_filter. Using --xml."))
             if $presentation_filter;
         $presentation_filter = 'xml';
     }
@@ -80,7 +81,7 @@
     my $get_remoterev = _log_remote_rev($target);
 
     if ($target->revision < max ($fromrev, $torev)) {
-	print loc ("Revision too large, show log from %1.\n", $target->revision);
+	$logger->warn(loc ("Revision too large, show log from %1.", $target->revision));
 	$fromrev = min ($target->revision, $fromrev);
 	$torev = min ($target->revision, $torev);
     }

Modified: trunk/lib/SVK/Command/Mirror.pm
==============================================================================
--- trunk/lib/SVK/Command/Mirror.pm	(original)
+++ trunk/lib/SVK/Command/Mirror.pm	Sat Nov 18 17:46:12 2006
@@ -161,6 +161,7 @@
 use base qw(SVK::Command::Mirror);
 use SVK::Util qw( traverse_history get_prompt );
 use SVK::I18N;
+use SVK::Logger;
 
 use constant narg => 1;
 
@@ -187,9 +188,9 @@
         callback    => sub {
             $rev = $_[1];
             $firstrev ||= $rev;
-            print loc("Analyzing revision %1...\n", $rev),
+            $logger->info(loc("Analyzing revision %1...\n", $rev),
                   ('-' x 70),"\n",
-                  $fs->revision_prop ($rev, 'svn:log'), "\n";
+                  $fs->revision_prop ($rev, 'svn:log'));
 
             if ( $headrev = $fs->revision_prop ($rev, 'svm:headrev') ) {
                 ($uuid, $rrev) = split(/[:\n]/, $headrev);
@@ -210,7 +211,7 @@
     }
 
     if (!$skipped) {
-        print loc("No need to revert; it is already the head revision.\n");
+        $logger->warn(loc("No need to revert; it is already the head revision."));
         return;
     }
 

Modified: trunk/lib/SVK/Command/Patch.pm
==============================================================================
--- trunk/lib/SVK/Command/Patch.pm	(original)
+++ trunk/lib/SVK/Command/Patch.pm	Sat Nov 18 17:46:12 2006
@@ -95,14 +95,15 @@
 
 use base qw/SVK::Command::Patch::FileRequired/;
 use SVK::I18N;
+use SVK::Logger;
 
 sub run {
     my ($self, $patch, $not_applicable) = @_;
 
     return $not_applicable if $not_applicable;
     if (my $conflicts = $patch->apply (1)) {
-	print loc("%*(%1,conflict) found.\n", $conflicts);
-	print loc("Please do a merge to resolve conflicts and regen the patch.\n");
+	$logger->error(loc("%*(%1,conflict) found.", $conflicts));
+	$logger->error(loc("Please do a merge to resolve conflicts and regen the patch."));
     }
 
     return;

Modified: trunk/lib/SVK/Command/Propset.pm
==============================================================================
--- trunk/lib/SVK/Command/Propset.pm	(original)
+++ trunk/lib/SVK/Command/Propset.pm	Sat Nov 18 17:46:12 2006
@@ -6,6 +6,7 @@
 use SVK::Util qw ( abs2rel );
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ($_[0]->SUPER::options,
@@ -38,11 +39,11 @@
         $fs->change_rev_prop ($rev, $propname => $propvalue);
 	unless ($self->{quiet}) {
 	    if (defined $propvalue) {
-		print loc("Property '%1' set on repository revision %2.\n",
-		    $propname, $rev);
+		$logger->info(loc("Property '%1' set on repository revision %2.",
+		    $propname, $rev));
 	    } else {
-		print loc("Property '%1' deleted from repository revision %2.\n",
-		    $propname, $rev);
+		$logger->info(loc("Property '%1' deleted from repository revision %2.",
+		    $propname, $rev));
 	    }
 	}
         return;

Modified: trunk/lib/SVK/Command/Revert.pm
==============================================================================
--- trunk/lib/SVK/Command/Revert.pm	(original)
+++ trunk/lib/SVK/Command/Revert.pm	Sat Nov 18 17:46:12 2006
@@ -7,6 +7,7 @@
 use SVK::XD;
 use SVK::Util qw( slurp_fh is_symlink to_native );
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ("q|quiet"    => 'quiet');
@@ -53,8 +54,8 @@
                           return $self->do_revert($target, $copath, $dpath, $xdroot);
                       } elsif ($st eq '?') {
 			  return unless $target->contains_copath ($copath);
-			  print loc("%1 is not versioned; ignored.\n",
-			      $target->report_copath ($copath));
+			  $logger->warn(loc("%1 is not versioned; ignored.",
+			      $target->report_copath ($copath)));
 			  return;
 		      }
 
@@ -98,7 +99,7 @@
     my ($self, $target, $copath) = @_;
     $self->{xd}{checkout}->store($copath, { $self->_schedule_empty,
 					    '.conflict' => undef }, {override_descendents => 0});
-    print loc("Reverted %1\n", $target->report_copath ($copath))
+    $logger->info(loc("Reverted %1", $target->report_copath ($copath)))
 	unless $self->{quiet};
 
 }

Modified: trunk/lib/SVK/Command/Smerge.pm
==============================================================================
--- trunk/lib/SVK/Command/Smerge.pm	(original)
+++ trunk/lib/SVK/Command/Smerge.pm	Sat Nov 18 17:46:12 2006
@@ -4,6 +4,7 @@
 
 use base qw( SVK::Command::Merge );
 use SVK::XD;
+use SVK::Logger;
 
 sub options {
     ($_[0]->SUPER::options,
@@ -17,7 +18,7 @@
     my ($self, @arg) = @_;
     $self->{auto}++;
     if ($self->{baserev}) {
-	print loc("--baserev is deprecated, use --base instead\n");
+	$logger->warn(loc("--baserev is deprecated, use --base instead"));
 	$self->{base} ||= $self->{baserev};
     }
     $self->SUPER::run (@arg);

Modified: trunk/lib/SVK/Command/Sync.pm
==============================================================================
--- trunk/lib/SVK/Command/Sync.pm	(original)
+++ trunk/lib/SVK/Command/Sync.pm	Sat Nov 18 17:46:12 2006
@@ -4,6 +4,7 @@
 
 use base qw( SVK::Command );
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ('s|skipto=s'	=> 'skip_to',
@@ -33,8 +34,8 @@
             my ( $arg, $path ) = $orig_arg =~ m{^/?([^/]*)/?(.*)?$};
             my ($depot) = eval { $self->{xd}->find_depot($arg) };
             unless ( defined $depot ) {
-                print loc( "%1 does not contain a valid depotname\n",
-                    $orig_arg );
+                $logger->error(loc( "%1 does not contain a valid depotname",
+                    $orig_arg ));
                 next;
             }
 
@@ -42,7 +43,7 @@
                 $depot->mirror->entries;
 
             if ( $path && $explicit{$orig_arg} && !@tempnewarg ) {
-                print loc( "no mirrors found underneath %1\n", $orig_arg );
+                $logger->warn(loc( "no mirrors found underneath %1", $orig_arg ));
                 next;
             }
             push @mirrors, map { $depot->mirror->get($_) } @tempnewarg;
@@ -59,7 +60,7 @@
 	    1;
 	};
         if ( $self->{sync_all} ) {
-            print loc( "Starting to synchronize %1\n", $m->get_svkpath->depotpath );
+            $logger->info(loc( "Starting to synchronize %1", $m->get_svkpath->depotpath ));
             eval { $run_sync->() };
             if ($@) {
 		++$error;

Modified: trunk/lib/SVK/Command/Update.pm
==============================================================================
--- trunk/lib/SVK/Command/Update.pm	(original)
+++ trunk/lib/SVK/Command/Update.pm	Sat Nov 18 17:46:12 2006
@@ -6,6 +6,7 @@
 use constant opt_recursive => 1;
 use SVK::XD;
 use SVK::I18N;
+use SVK::Logger;
 
 sub options {
     ('r|revision=s'    => 'rev',
@@ -115,9 +116,9 @@
 
     my $content_revision = $update_target->isa('SVK::Path::View') ?
 	$update_target->source->revision : $update_target->revision;
-    print loc("Syncing %1(%2) in %3 to %4.\n", $cotarget->depotpath,
+    $logger->info(loc("Syncing %1(%2) in %3 to %4.", $cotarget->depotpath,
 	      $cotarget->path_anchor, $cotarget->copath,
-	      $content_revision);
+	      $content_revision));
 
     if ($kind == $SVN::Node::file ) {
 	$cotarget->anchorify;

Modified: trunk/lib/SVK/Editor/Copy.pm
==============================================================================
--- trunk/lib/SVK/Editor/Copy.pm	(original)
+++ trunk/lib/SVK/Editor/Copy.pm	Sat Nov 18 17:46:12 2006
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use SVK::Version;  our $VERSION = $SVK::VERSION;
+use SVK::Logger;
 
 require SVN::Delta;
 use base 'SVK::Editor::ByPass';
@@ -85,7 +86,7 @@
 	$pool->clear;
 	my ($toroot, $fromroot, $src_frompath) =
 	    SVK::Path::nearest_copy($cur_root, $cur_path, $ppool);
-	warn "===> $cur_path => $src_frompath" if $main::DEBUG;
+	$logger->debug("===> $cur_path => ".($src_frompath||''));
 	return unless defined $src_frompath;
 
 	# don't use the same copy twice
@@ -148,13 +149,12 @@
 	}
 
 	# GRR! cleanup this!
-	warn "==> $path(:$to) is copied from $src_frompath:$src_from" if $main::DEBUG;
+	$logger->debug("==> $path(:$to) is copied from $src_frompath:$src_from");
 	if (my ($frompath, $from) = $self->{cb_resolve_copy}->($path, $replace, $src_frompath, $src_from)) {
 	    push @{$self->{incopy}}, { path => $path,
 				       fromrev => $src_from,
 				       frompath => $src_frompath };
-	    warn "==> resolved to $frompath:$from"
-		if $main::DEBUG;
+	    $logger->debug("==> resolved to $frompath:$from");
 	    return $self->copy_source($src_frompath, $src_from);
 	}
 	else {
@@ -212,7 +212,7 @@
     my ($self, $path, $pbaton, @arg) = @_;
     return $self->{ignore_baton} if $self->should_ignore($path, $pbaton);
     if (my @ret = $self->find_copy($path, 1)) {
-	warn "==> turn $path into replace: ".join(',', at ret) if $main::DEBUG;
+	$logger->debug("==> turn $path into replace: ".join(',', at ret));
 	$self->SUPER::delete_entry($path, $arg[0], $pbaton, $arg[1]);
 	return $self->replay_add_history('directory', $path, $pbaton, @ret, $arg[1])
     }
@@ -224,7 +224,7 @@
     my ($self, $path, $pbaton, @arg) = @_;
     return $self->{ignore_baton} if $self->should_ignore($path, $pbaton);
     if (my @ret = $self->find_copy($path, 1)) {
-	warn "==> turn file $path into replace" if $main::DEBUG;
+	$logger->debug("==> turn file $path into replace");
 	$self->SUPER::delete_entry($path, $arg[0], $pbaton, $arg[1]);
 	return $self->replay_add_history('file', $path, $pbaton, @ret, $arg[1])
     }
@@ -307,8 +307,8 @@
 	 translate => sub { $_[0] =~ s/^\Q$src_target/$target/ })
 	    if $type eq 'file';
 
-    warn "****==> to delta $src_anchor / $src_target @ $self->{incopy}[-1]{fromrev} vs $self->{src}{path} / $path" if $main::DEBUG;;
-    warn "==> sample" if $main::DEBUG;
+    $logger->debug("****==> to delta $src_anchor / $src_target @ $self->{incopy}[-1]{fromrev} vs $self->{src}{path} / $path");
+    $logger->debug("==> sample");
     require SVK::Editor::Delay;
     SVK::XD->depot_delta
 	    ( oldroot => $self->{copyboundry_root}->fs->
@@ -316,8 +316,8 @@
 	      newroot => $self->{src}->root,
 	      oldpath => [$src_anchor, $src_target],
 	      newpath => File::Spec::Unix->catdir($self->{src}->path_anchor, $path),
-	      editor => SVN::Delta::Editor->new(_debug => 1)) if $main::DEBUG;
-    warn "==> done sample" if $main::DEBUG;
+	      editor => SVN::Delta::Editor->new(_debug => 1)) if $logger->is_debug();
+    $logger->debug("==> done sample");
     SVK::XD->depot_delta
 	    ( oldroot => $self->{copyboundry_root}->fs->
 	      revision_root($self->{incopy}[-1]{fromrev}),
@@ -325,7 +325,7 @@
 	      oldpath => [$src_anchor, $src_target],
 	      newpath => File::Spec::Unix->catdir($self->{src}->path_anchor, $path),
 	      editor => SVK::Editor::Delay->new(_editor => [$editor]) );
-    warn "***=>done delta" if $main::DEBUG;
+    $logger->debug("***=>done delta");
     # close file is done by the delta;
     return bless { path => $path,
 		   baton => $baton,

Modified: trunk/lib/SVK/Editor/Merge.pm
==============================================================================
--- trunk/lib/SVK/Editor/Merge.pm	(original)
+++ trunk/lib/SVK/Editor/Merge.pm	Sat Nov 18 17:46:12 2006
@@ -4,6 +4,7 @@
 
 use base 'SVK::Editor';
 use SVK::I18N;
+use SVK::Logger;
 use autouse 'SVK::Util'
     => qw( slurp_fh md5_fh tmpfile devnull abs2rel );
 
@@ -941,7 +942,7 @@
 	$self->{storage}->close_edit(@arg);
     }
     else {
-	print loc("Empty merge.\n") unless $self->{notify}{quiet};
+	$logger->warn(loc("Empty merge.")) unless $self->{notify}{quiet};
 	$self->{storage}->abort_edit(@arg);
     }
 }

Modified: trunk/lib/SVK/Editor/Status.pm
==============================================================================
--- trunk/lib/SVK/Editor/Status.pm	(original)
+++ trunk/lib/SVK/Editor/Status.pm	Sat Nov 18 17:46:12 2006
@@ -1,6 +1,7 @@
 package SVK::Editor::Status;
 use strict;
 use SVN::Delta;
+use SVK::Logger;
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use base 'SVK::Editor';
 
@@ -13,7 +14,7 @@
 		   (defined $self->report ? $self->report : '') ) unless $self->notify;
     $self->tree(Data::Hierarchy->new) unless $self->tree;
     use Data::Dumper;
-    warn Dumper($self) if $main::DEBUG;
+    $logger->debug(Dumper($self));
     return $self;
 }
 

Modified: trunk/lib/SVK/Help/Environment.pod
==============================================================================
--- trunk/lib/SVK/Help/Environment.pod	(original)
+++ trunk/lib/SVK/Help/Environment.pod	Sat Nov 18 17:46:12 2006
@@ -53,6 +53,13 @@
 If you want svk to spawn a specific merge tool, set this variable to
 the tool's name.
 
+=item $SVKLOGLEVEL
+
+The lowest log level that svk will present to the user. The log levels
+are: DEBUG, INFO, WARN, ERROR and FATAL. The default log level is INFO;
+this includes progress messages for long-running commands (such as
+sync). For non-interactive use (such as for cron jobs) it might be
+useful to set $SVKLOGLEVEL to WARN.
 
 =item $SVKRESOLVE
 

Added: trunk/lib/SVK/Logger.pm
==============================================================================
--- (empty file)
+++ trunk/lib/SVK/Logger.pm	Sat Nov 18 17:46:12 2006
@@ -0,0 +1,98 @@
+package SVK::Logger;
+use strict;
+use warnings;
+
+use SVK::Version;  our $VERSION = $SVK::VERSION;
+
+use Log::Log4perl qw(get_logger :levels);
+
+my $level = {
+    map { $_ => uc $_ } qw( debug info warn error fatal )
+}->{ lc $ENV{SVKLOGLEVEL} } || 'INFO';
+
+my $conf = qq{
+  log4perl.rootLogger=$level, Screen
+  log4perl.appender.Screen = Log::Log4perl::Appender::Screen
+  log4perl.appender.Screen.stderr = 0
+  log4perl.appender.Screen.layout = PatternLayout
+  log4perl.appender.Screen.layout.ConversionPattern = %m%n
+};
+
+# ... passed as a reference to init()
+Log::Log4perl::init( \$conf );
+    
+sub import {
+  my $class = shift;
+  my $var = shift || 'logger';
+  
+  # it's ok if people add a sigil; we can get rid of that.
+  $var =~ s/^\$*//;
+  
+  # Find out which package we'll export into.
+  my $caller = caller() . '';
+
+  (my $name = $caller) =~ s/::/./g;
+  my $logger = Log::Log4perl->get_logger(lc($name));
+  {
+    # As long as we don't use a package variable, each module we export
+    # into will get their own object. Also, this allows us to decide on 
+    # the exported variable name. Hope it isn't too bad form...
+    no strict 'refs';
+    *{ $caller . "::$var" } = \$logger;
+  }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+SVK::Logger - logging framework for SVK
+
+=head1 SYNOPSIS
+
+  use SVK::Logger;
+  
+  $logger->warn('foo');
+  $logger->info('bar');
+  
+or 
+
+  use SVK::Logger '$foo';
+  
+  $foo->error('bad thingimajig');
+
+=head2 DESCRIPTION
+
+SVK::Logger is a wrapper around Log::Log4perl. When using the module, it
+imports into your namespace a variable called $logger (or you can pass a
+variable name to import to decide what the variable should be) with a
+category based on the name of the calling module.
+
+=head1 MOTIVATION
+
+Ideally, for support requests, if something is not going the way it
+should be we should be able to tell people: "rerun the command with the
+SVKLOGLEVEL environment variable set to DEBUG and mail the output to
+$SUPPORTADDRESS". On Unix, this could be accomplished in one command like so:
+
+  env SVKLOGLEVEL=DEBUG svk <command that failed> 2>&1 | mail $SUPPORTADDRESS
+
+=head1 AUTHORS
+
+Stig Brautaset E<lt>stig at brautaset.orgE<gt>
+
+Chia-liang Kao E<lt>clkao at clkao.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright 2003-2006 by Chia-liang Kao E<lt>clkao at clkao.orgE<gt>.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+
+=cut

Modified: trunk/lib/SVK/Merge.pm
==============================================================================
--- trunk/lib/SVK/Merge.pm	(original)
+++ trunk/lib/SVK/Merge.pm	Sat Nov 18 17:46:12 2006
@@ -6,6 +6,7 @@
 use SVK::Editor::Rename;
 use SVK::Editor::Translate;
 use SVK::Editor::Delay;
+use SVK::Logger;
 use List::Util qw(min);
 
 =head1 NAME
@@ -301,7 +302,7 @@
     my $newinfo = $dstinfo->union ($srcinfo)->del_target ($self->{dst});
     unless ($self->{quiet}) {
 	for (sort keys %$newinfo) {
-	    print loc("New merge ticket: %1:%2\n", $_, $newinfo->{$_}{rev})
+	    $logger->info(loc("New merge ticket: %1:%2", $_, $newinfo->{$_}{rev}))
 		if !$dstinfo->{$_} || $newinfo->{$_}{rev} > $dstinfo->{$_}{rev};
 	}
     }
@@ -518,8 +519,7 @@
 		      }) or die loc("Can't find the first revision of %1.\n", $src->path);
 	    }
 	}
-	warn "==> got $boundry_rev as copyboundry, add $self->{fromrev} as boundry as well"
-	    if $main::DEBUG;
+	$logger->debug("==> got $boundry_rev as copyboundry, add $self->{fromrev} as boundry as well");
 
 	if (defined $boundry_rev) {
 	  require SVK::Editor::Copy;
@@ -563,10 +563,10 @@
 	      no_recurse => $self->{no_recurse}, editor => $editor,
 	    );
     unless ($self->{quiet}) {
-	print loc("%*(%1,conflict) found.\n", $meditor->{conflicts})
+	$logger->warn(loc("%*(%1,conflict) found.", $meditor->{conflicts}))
 	    if $meditor->{conflicts};
-	print loc("%*(%1,file) skipped, you might want to rerun merge with --track-rename.\n",
-		  $meditor->{skipped}) if $meditor->{skipped} && !$self->{track_rename} && !$self->{auto};
+	$logger->warn(loc("%*(%1,file) skipped, you might want to rerun merge with --track-rename.",
+		  $meditor->{skipped})) if $meditor->{skipped} && !$self->{track_rename} && !$self->{auto};
     }
 
     return $meditor->{conflicts};
@@ -575,7 +575,7 @@
  # translate to (path, rev) for dst
 sub resolve_copy {
     my ($self, $srcinfo, $dstinfo, $cp_path, $cp_rev) = @_;
-    warn "==> to resolve $cp_path $cp_rev" if $main::DEBUG;
+    $logger->debug("==> to resolve $cp_path $cp_rev");
     my $path = $cp_path;
     my $src = $self->{src};
     my $srcpath = $src->path;

Modified: trunk/lib/SVK/Mirror.pm
==============================================================================
--- trunk/lib/SVK/Mirror.pm	(original)
+++ trunk/lib/SVK/Mirror.pm	Sat Nov 18 17:46:12 2006
@@ -3,6 +3,7 @@
 use warnings;
 
 use SVN::Core;
+use SVK::Logger;
 
 use Sys::Hostname;
 use SVK::I18N;
@@ -323,12 +324,12 @@
     my ($self, $torev) = @_;
     return $self->run_svnmirror_sync({ torev => $torev }) unless $self->_backend->has_replay;
 
-    print loc("Syncing %1", $self->url).($self->_backend->_relayed ? loc(" via %1\n", $self->server_url) : "\n");
+    $logger->info(loc("Syncing %1", $self->url).($self->_backend->_relayed ? loc(" via %1", $self->server_url) : ""));
 
     $self->mirror_changesets($torev,
         sub {
             my ( $changeset, $rev ) = @_;
-            print "Committed revision $rev from revision $changeset.\n";
+            $logger->info("Committed revision $rev from revision $changeset.");
         }
     );
     die $@ if $@;
@@ -336,7 +337,7 @@
 
 sub sync_snapshot {
     my ($self, $snapshot) = @_;
-    print loc("
+    $logger->warn(loc("
 svk is now taking a snapshot of the repository at:
   %1
 
@@ -344,7 +345,7 @@
 url contains directories like trunk and branches.  If this isn't what
 you mean, please hit ^C.
 
-", $self->url);
+", $self->url));
 
     $self->run_svnmirror_sync( { skip_to => $snapshot });
 }
@@ -355,9 +356,9 @@
     my $i = 0;
     sub {
 	my ($mirror, $who) = @_;
-	print loc("Waiting for lock on %1: %2.\n", $target->depotpath, $who);
+	$logger->warn(loc("Waiting for lock on %1: %2.", $target->depotpath, $who));
 	if (++$i % 3 == 0) {
-	    print loc ("
+	    $logger->error(loc ("
 The mirror is currently locked. This might be because the mirror is
 in the middle of a sensitive operation or because a process holding
 the lock hung or died.  To check if the mirror lock is stalled,  see
@@ -365,7 +366,7 @@
 
 If the mirror lock is stalled, please interrupt this process and run:
     svk mirror --unlock %1
-", $target->depotpath);
+", $target->depotpath));
 	}
     }
 }

Modified: trunk/lib/SVK/Patch.pm
==============================================================================
--- trunk/lib/SVK/Patch.pm	(original)
+++ trunk/lib/SVK/Patch.pm	Sat Nov 18 17:46:12 2006
@@ -3,6 +3,7 @@
 use SVK::I18N;
 use SVK::Util qw( read_file write_file );
 use SVK::Version;  our $VERSION = $SVK::VERSION;
+use SVK::Logger;
 
 =head1 NAME
 
@@ -262,7 +263,7 @@
 				     SVK::Editor::Merge->cb_for_root
 				     ($target->root, $target->path, $target->revision))) {
 
-	print loc("Conflicts.\n");
+	$logger->error(loc("Conflicts."));
 	return $conflict;
     }
 
@@ -277,7 +278,7 @@
     my $target = $self->{_target}
 	or die loc("Target not local nor mirrored, unable to regen patch.\n");
     unless ($self->{level} == 0 || $self->{_source_updated}) {
-	print loc("Source of patch %1 not updated or not local, no need to regen patch.\n", $self->{name});
+	$logger->warn(loc("Source of patch %1 not updated or not local, no need to regen patch.", $self->{name}));
 	return;
     }
     my $source = $self->{_source}->new->refresh_revision;
@@ -330,6 +331,7 @@
 package SVK::Patch::CommitEditor;
 use base qw(SVK::Editor::Patch);
 use SVK::I18N;
+use SVK::Logger;
 
 sub close_edit {
     my $self = shift;
@@ -340,7 +342,7 @@
     ++$patch->{level};
     $patch->store ($filename);
     return if $filename eq '-';
-    print loc ("Patch %1 created.\n", $patch->{name});
+    $logger->warn(loc ("Patch %1 created.", $patch->{name}));
 }
 
 =head1 AUTHORS

Modified: trunk/lib/SVK/Path.pm
==============================================================================
--- trunk/lib/SVK/Path.pm	(original)
+++ trunk/lib/SVK/Path.pm	Sat Nov 18 17:46:12 2006
@@ -7,6 +7,7 @@
 use Class::Autouse qw(SVK::Editor::Dynamic SVK::Editor::TxnCleanup);
 use SVN::Delta;
 
+use SVK::Logger;
 use SVK::Depot;
 use base 'SVK::Accessor';
 
@@ -200,7 +201,7 @@
 
 	my ($base_rev, $editor) = $m->get_merge_back_editor
 	    ($mpath, $arg{message}, $mcallback);
-	$editor->{_debug}++ if $main::DEBUG;
+	$editor->{_debug}++ if $logger->is_debug();
 	return ($editor, $inspector,
 		mirror => $m,
 		post_handler => \$post_handler,
@@ -620,7 +621,7 @@
     $self = $self->new->as_depotpath;
     my $usrc = $src->universal;
     my $srckey = join(':', $usrc->{uuid}, $usrc->{path});
-    warn "trying to look for the revision on $self->{path} that was merged from $srckey\@$src->{revision} at $path" if $main::DEBUG;
+    $logger->debug("trying to look for the revision on $self->{path} that was merged from $srckey\@$src->{revision} at $path");
 
     my %copies = map { join(':', $_->{uuid}, $_->{path}) => $_ }
 	reverse $merge->copy_ancestors($self);
@@ -628,7 +629,7 @@
     $self->search_revision
 	( cmp => sub {
 	      my $rev = shift;
-	      warn "==> look at $rev" if $main::DEBUG;
+	      $logger->debug("==> look at $rev");
 	      my $search = $self->new(revision => $rev);
 	      my $minfo = { %copies,
 			    %{$merge->merge_info($search)} };
@@ -658,7 +659,7 @@
 	      }
 
 	      # see if prev got different merge info about srckey.
-	      warn "==> to compare with $prev" if $main::DEBUG;
+	      $logger->debug("==> to compare with $prev");
 	      my $uret = $merge->merge_info_with_copy
 		  ($self->new(revision => $prev))->{$srckey}
 		      or return 0;

Modified: trunk/lib/SVK/Path/View.pm
==============================================================================
--- trunk/lib/SVK/Path/View.pm	(original)
+++ trunk/lib/SVK/Path/View.pm	Sat Nov 18 17:46:12 2006
@@ -2,7 +2,7 @@
 use strict;
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use SVK::I18N;
-
+use SVK::Logger;
 use base 'SVK::Path';
 
 __PACKAGE__->mk_clonable_accessors(qw(source));
@@ -70,7 +70,7 @@
 	    );
     }
     $editor = SVN::Delta::Editor->new(_debug => 1, _editor => [$editor])
-	if $main::DEBUG;
+	if $logger->is_debug();
     return ($editor, $inspector, %extra);
 }
 

Modified: trunk/lib/SVK/Resolve.pm
==============================================================================
--- trunk/lib/SVK/Resolve.pm	(original)
+++ trunk/lib/SVK/Resolve.pm	Sat Nov 18 17:46:12 2006
@@ -6,6 +6,7 @@
     read_file can_run is_executable bsd_glob
 );
 use File::Copy ();
+use SVK::Logger;
 
 use constant Actions => {qw(
     a   accept      e   edit        d   diff
@@ -122,12 +123,12 @@
     ) : $self->get_resolver);
 
     if (!$resolver) {
-        print loc("Cannot launch an external merge tool for %1.\n", $path);
+        $logger->error(loc("Cannot launch an external merge tool for %1.", $path));
         return;
     }
 
     # maybe some message here
-    print loc("Invoking merge tool '%1' for %2.\n", $resolver->name, $path);
+    $logger->info(loc("Invoking merge tool '%1' for %2.", $resolver->name, $path));
 
     if ($resolver->run_resolver($cmd, @args)) {
         $self->{has_conflict} = (

Modified: trunk/lib/SVK/Resolve/Emacs.pm
==============================================================================
--- trunk/lib/SVK/Resolve/Emacs.pm	(original)
+++ trunk/lib/SVK/Resolve/Emacs.pm	Sat Nov 18 17:46:12 2006
@@ -3,6 +3,7 @@
 use base 'SVK::Resolve';
 use SVK::I18N;
 use SVK::Util qw( devnull );
+use SVK::Logger;
 
 sub commands { 'gnuclient-emacs' }
 
@@ -47,7 +48,7 @@
     my ($self, $cmd, @args) = @_;
 
     local $SIG{$self->{signal}} = sub {
-        print loc("Emerge %1 done.\n");
+        $logger->info(loc("Emerge %1 done."));
         $self->{finished} = 1;
     };
 
@@ -56,10 +57,10 @@
         die loc("Cannot fork: %1", $!);
     }
     elsif ($pid) {
-        print loc(
-            "Started %1, Try 'kill -%2 %3' to terminate if things mess up.\n",
+        $logger->warn(loc(
+            "Started %1, Try 'kill -%2 %3' to terminate if things mess up.",
             $pid, $self->{signal}, $$,
-        );
+        ));
         sleep 1 until $self->{finished};
     }
     else {

Modified: trunk/lib/SVK/Test.pm
==============================================================================
--- trunk/lib/SVK/Test.pm	(original)
+++ trunk/lib/SVK/Test.pm	Sat Nov 18 17:46:12 2006
@@ -8,6 +8,8 @@
 use SVK::Version;  our $VERSION = $SVK::VERSION;
 use base 'Exporter';
 
+use SVK::Logger;
+
 our @EXPORT = qw(plan_svm new_repos build_test build_floating_test
 		 get_copath append_file overwrite_file
 		 overwrite_file_raw is_file_content
@@ -63,11 +65,11 @@
     *SVK::Util::get_prompt = *SVK::XD::get_prompt = sub {
 	local $| = 1;
 	print "$_[0]\n" if $show_prompt;
-	print STDOUT "$_[0]\n" if $main::DEBUG;
+	$logger->debug("$_[0]");
 	return $answer unless ref($answer); # compat
 	die "expecting input" unless @$answer;
 	my $ans = shift @$answer;
-	print STDOUT "-> $answer->[0]\n" if $main::DEBUG;
+	$logger->debug("-> ".($answer->[0]||''));
 	return $ans unless ref($ans);
 	
 	if (ref($ans->[0]) eq 'Regexp') {

Modified: trunk/lib/SVK/Util.pm
==============================================================================
--- trunk/lib/SVK/Util.pm	(original)
+++ trunk/lib/SVK/Util.pm	Sat Nov 18 17:46:12 2006
@@ -29,6 +29,7 @@
 
 
 use Config ();
+use SVK::Logger;
 use SVK::I18N;
 use SVN::Core;
 use autouse 'Encode'            => qw(resolve_alias($) decode encode);
@@ -38,6 +39,7 @@
                                qw(catdir catpath splitpath splitdir tmpdir);
 use autouse 'List::Util'        => qw( max(@) );
 
+
 =head1 NAME
 
 SVK::Util - Utility functions for SVK classes
@@ -202,7 +204,7 @@
 			: DEFAULT_EDITOR; # fall back to something
     my @editor = split (/ /, $editor);
 
-    print loc("Waiting for editor...\n");
+    $logger->info(loc("Waiting for editor..."));
 
     # XXX: check $?
     system {$editor[0]} (@editor, $file) and die loc("Aborted: %1\n", $!);
@@ -773,10 +775,10 @@
         File::Copy::move ($source => $target) and return;
     }
 
-    print loc(
-        "Cannot rename %1 to %2; please move it manually.\n",
+    $logger->error(loc(
+        "Cannot rename %1 to %2; please move it manually.",
         catfile($source), catfile($target),
-    );
+    ));
 }
 
 =head3 traverse_history (root => $fs_root, path => $path,

Modified: trunk/lib/SVK/XD.pm
==============================================================================
--- trunk/lib/SVK/XD.pm	(original)
+++ trunk/lib/SVK/XD.pm	Sat Nov 18 17:46:12 2006
@@ -23,6 +23,8 @@
 use SVK::Depot;
 use SVK::Config;
 
+use SVK::Logger;
+
 =head1 NAME
 
 SVK::XD - svk depot and checkout handling.
@@ -157,8 +159,8 @@
 	$info = eval {LoadFile ($self->{statefile})};
 	if ($@) {
 	    rename ($self->{statefile}, "$self->{statefile}.backup");
-	    print loc ("Can't load statefile, old statefile saved as %1\n",
-		     "$self->{statefile}.backup");
+	    $logger->warn(loc ("Can't load statefile, old statefile saved as %1",
+		     "$self->{statefile}.backup"));
 	}
         elsif ($info) {
             $info->{checkout}{sep} = $SEP;
@@ -218,7 +220,7 @@
     $self->{giantlock_handle} or
         die "Internal error: trying to save config without a lock!\n";
 
-    local $SIG{INT} = sub { warn loc("Please hold on a moment. SVK is writing out a critical configuration file.\n")};
+    local $SIG{INT} = sub { $logger->warn( loc("Please hold on a moment. SVK is writing out a critical configuration file."))};
 
     my $file = $self->{statefile};
     my $tmpfile = $file."-$$";
@@ -607,7 +609,7 @@
 	    enumerate ('auto-props',
 		       sub { $self->{svnautoprop}{compile_apr_fnmatch($_[0])} = $_[1]; 1} );
     };
-    warn "Your svn is too old, auto-prop in svn config is not supported: $@\n" if $@;
+    $logger->warn("Your svn is too old, auto-prop in svn config is not supported: $@") if $@;
 }
 
 sub auto_prop {
@@ -984,11 +986,11 @@
 		$seen{$copath} = 1;
 		lstat $copath;
 		unless (-e _) {
-		    print loc ("Unknown target: %1.\n", $copath);
+		    $logger->warn( loc ("Unknown target: %1.", $copath));
 		    next ENTRY;
 		}
 		unless (-r _) {
-		    print loc ("Warning: %1 is unreadable.\n", $copath);
+		    $logger->warn( loc ("Warning: %1 is unreadable.", $copath));
 		    next ENTRY;
 		}
 		$arg{cb_unknown}->($arg{editor}, catdir($arg{entry}, $now), $arg{baton});
@@ -1126,12 +1128,12 @@
     my $st = [lstat ($copath)];
     return '' if !-e _;
     unless (-r _) {
-	print loc ("Warning: $copath is unreadable.\n");
+	$logger->warn( loc ("Warning: $copath is unreadable."));
 	return;
     }
     return ('file', $st) if -f _ or is_symlink;
     return ('directory', $st) if -d _;
-    print loc ("Warning: unsupported node type $copath.\n");
+    $logger->warn( loc ("Warning: unsupported node type $copath."));
     return ('', $st);
 }
 
@@ -1429,7 +1431,7 @@
 	    for sort keys %$newprops;
     }
     if (defined $targets) {
-	print loc ("Unknown target: %1.\n", $_) for sort keys %$targets;
+	$logger->warn(loc ("Unknown target: %1.", $_)) for sort keys %$targets;
     }
 
     $arg{editor}->close_directory ($baton, $pool)
@@ -1492,7 +1494,7 @@
     my $val = $self->{checkout}->get ($entry, 1);
     return unless $val && $val->{'.conflict'};
     $self->{checkout}->store ($entry, {%$val, '.conflict' => undef});
-    print loc("%1 marked as resolved.\n", $entry);
+    $logger->warn(loc("%1 marked as resolved.", $entry));
 }
 
 sub do_resolved {


More information about the svk-commit mailing list