summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-11-25 17:36:15 +0530
committerAndinus <andinus@nand.sh>2020-11-25 17:39:45 +0530
commitc52d2400b43d29422f59fc091222dcea8f3a1b97 (patch)
treebed2669171717aee9f45fe84542dd194d6799468
parentc3648a0e486ad09f0da857598bb6b559af082c18 (diff)
downloaddraco-c52d2400b43d29422f59fc091222dcea8f3a1b97.tar.gz
Keep each dot in a single line
It could put a lot of dots, each in new line which makes reading previous debug messages hard.
-rwxr-xr-xdraco.pl16
1 files changed, 12 insertions, 4 deletions
diff --git a/draco.pl b/draco.pl
index 1915a3f..ee21f06 100755
--- a/draco.pl
+++ b/draco.pl
@@ -123,6 +123,11 @@ print STDERR "each dot is a HTTP call.\n"
# Iterate over top-level comments. The second argument is level
# (depth), it should be 0 for top-level comments.
iterate_over_comments($comments, 0);
+
+# Seperate the dots with the rest by a "\n".
+print STDERR "\n"
+ if $DEBUG and $ENV{FETCH_ALL};
+
print_time() if $DEBUG;
# Print important stats.
@@ -144,7 +149,7 @@ sub print_time {
sub get_response {
my $url = shift @_;
# Skip a dot on first HTTP call.
- print STDERR ".\n" if $DEBUG and scalar @http_calls > 0;
+ print STDERR "." if $DEBUG and scalar @http_calls > 0;
my $response = $http->get($url);
push @http_calls, $url;
die "Unexpected response - $response->{status}: $response->{reason} : $url"
@@ -236,7 +241,8 @@ sub iterate_over_comments {
return 1;
} ) {
my $err = $@;
- print STDERR "parsing `$comment_id' failed: $err\n";
+ # Keep the "\n" at the start.
+ warn "\nparsing `$comment_id' failed: $err\n";
}
# This comment thread has been parsed, move on to the text
@@ -294,7 +300,8 @@ sub iterate_over_comments {
return 1;
} ) {
my $err = $@;
- warn "parsing `$comment_data->{id}' failed: $err\n";
+ # Keep the "\n" at the start.
+ warn "\nparsing `$comment_data->{id}' failed: $err\n";
}
} else {
# If we reach this block then it means that multiple
@@ -314,7 +321,8 @@ sub iterate_over_comments {
return 1;
} ) {
my $err = $@;
- warn "parsing `$comment_data->{id}' failed: $err\n";
+ # Keep the "\n" at the start.
+ warn "\nparsing `$comment_data->{id}' failed: $err\n";
}
}
}