Improve debug output

This commit is contained in:
Adam Spiers 2011-11-17 19:47:20 +00:00
parent da7255528e
commit c23e314848

21
stow.in
View file

@ -385,7 +385,7 @@ sub set_stow_path {
$Stow_Path = File::Spec->abs2rel($stow_dir); $Stow_Path = File::Spec->abs2rel($stow_dir);
debug(2, "current dir is " . getcwd()); debug(2, "current dir is " . getcwd());
debug(2, "stow dir path is $Stow_Path"); debug(2, "stow dir path relative to cwd is $Stow_Path");
} }
#===== SUBROUTINE =========================================================== #===== SUBROUTINE ===========================================================
@ -403,7 +403,8 @@ sub set_stow_path {
sub stow_contents { sub stow_contents {
my ($path, $target, $source) = @_; my ($path, $target, $source) = @_;
debug(2, "Stowing contents of $path"); my $cwd = getcwd();
debug(2, "Stowing contents of $path (cwd is $cwd)");
debug(3, "--- $target => $source"); debug(3, "--- $target => $source");
if (not -d $path) { if (not -d $path) {
@ -443,7 +444,7 @@ sub stow_contents {
sub stow_node { sub stow_node {
my ($path, $target, $source) = @_; my ($path, $target, $source) = @_;
debug(2, "Stowing $path"); debug(2, "Stowing from $path");
debug(3, "--- $target => $source"); debug(3, "--- $target => $source");
# don't try to stow absolute symlinks (they can't be unstowed) # don't try to stow absolute symlinks (they can't be unstowed)
@ -548,8 +549,9 @@ sub unstow_contents_orig {
if ($target eq $Stow_Path or -e "$target/.stow" or -e "$target/.nonstow") { if ($target eq $Stow_Path or -e "$target/.stow" or -e "$target/.nonstow") {
return; return;
} }
debug(2, "Unstowing in $target"); my $cwd = getcwd();
debug(3, "--- path is $path"); debug(2, "Unstowing from $target (compat mode, cwd is $cwd)");
debug(3, "--- source path is $path");
if (not -d $target) { if (not -d $target) {
error("unstow_contents() called on a non-directory: $target"); error("unstow_contents() called on a non-directory: $target");
} }
@ -583,8 +585,8 @@ sub unstow_contents_orig {
sub unstow_node_orig { sub unstow_node_orig {
my ($path, $target) = @_; my ($path, $target) = @_;
debug(2, "Unstowing $target"); debug(2, "Unstowing $target (compat mode)");
debug(3, "--- path is $path"); debug(3, "--- source path is $path");
# does the target exist # does the target exist
if (is_a_link($target)) { if (is_a_link($target)) {
@ -648,8 +650,9 @@ sub unstow_contents {
if ($target eq $Stow_Path or -e "$target/.stow") { if ($target eq $Stow_Path or -e "$target/.stow") {
return; return;
} }
debug(2, "Unstowing in $target"); my $cwd = getcwd();
debug(3, "--- path is $path"); debug(2, "Unstowing from $target (cwd is $cwd)");
debug(3, "--- source path is $path");
if (not -d $path) { if (not -d $path) {
error("unstow_contents() called on a non-directory: $path"); error("unstow_contents() called on a non-directory: $path");
} }