From c52d2400b43d29422f59fc091222dcea8f3a1b97 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 25 Nov 2020 17:36:15 +0530 Subject: 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. --- draco.pl | 16 ++++++++++++---- 1 file 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"; } } } -- cgit 1.4.1-2-gfad0