Skip to content

Commit 3bbab41

Browse files
Add debug_log() for helpful debugging later
1 parent 4130530 commit 3bbab41

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

diff-so-fancy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,4 +1071,19 @@ sub init_diff_highlight_colors {
10711071
$DiffHighlight::OLD_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.oldhighlight')) || $DiffHighlight::OLD_HIGHLIGHT[1];
10721072
}
10731073

1074+
sub debug_log {
1075+
my $log_line = shift();
1076+
my $file = "/tmp/diff-so-fancy.debug.log";
1077+
1078+
state $fh;
1079+
if (!$fh) {
1080+
printf("%sDebug log enabled:%s $file\n", color('orange'), color());
1081+
open ($fh, ">", $file) or die("Cannot write to $file");
1082+
}
1083+
1084+
print $fh trim($log_line) . "\n";
1085+
1086+
return 1;
1087+
}
1088+
10741089
# vim: tabstop=4 shiftwidth=4 noexpandtab autoindent softtabstop=4

0 commit comments

Comments
 (0)