privoxy-log-parser: Highlight the Crunch reason only once
authorFabian Keil <fk@fabiankeil.de>
Fri, 5 Aug 2022 07:41:12 +0000 (09:41 +0200)
committerFabian Keil <fk@fabiankeil.de>
Sun, 7 Aug 2022 08:16:38 +0000 (10:16 +0200)
Previously the "crunch reason" could also be highlighted when
the URL contained a matching string. The real crunch reason
only occurs once per line, so there's no need to continue
looking for it after it has been found once.

While at it, add a comment with an example log line.

tools/privoxy-log-parser.pl

index 905767d..b511931 100755 (executable)
@@ -1460,7 +1460,8 @@ sub handle_loglevel_crunch($) {
 
     # Highlight crunch reason
     foreach my $reason (keys %reason_colours) {
-        $content =~ s@($reason)@$reason_colours{$reason}$1$h{'Standard'}@g;
+        # Crunch: Blocked: https://capture.condenastdigital.com/track?_o=cne&[...]&dim2=%7B%22adBlocked%[...]
+        $content =~ s@($reason)@$reason_colours{$reason}$1$h{'Standard'}@;
     }
 
     if ($content =~ m/\[too long, truncated\]$/) {