Skip to content

Commit

Permalink
Add debug_log() for helpful debugging later
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed Jun 1, 2021
1 parent 4130530 commit 3bbab41
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions diff-so-fancy
Expand Up @@ -1071,4 +1071,19 @@ sub init_diff_highlight_colors {
$DiffHighlight::OLD_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.oldhighlight')) || $DiffHighlight::OLD_HIGHLIGHT[1];
}

sub debug_log {
my $log_line = shift();
my $file = "/tmp/diff-so-fancy.debug.log";

state $fh;
if (!$fh) {
printf("%sDebug log enabled:%s $file\n", color('orange'), color());
open ($fh, ">", $file) or die("Cannot write to $file");
}

print $fh trim($log_line) . "\n";

return 1;
}

# vim: tabstop=4 shiftwidth=4 noexpandtab autoindent softtabstop=4

0 comments on commit 3bbab41

Please sign in to comment.