From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 5 Aug 2022 07:41:12 +0000 (+0200)
Subject: privoxy-log-parser: Highlight the Crunch reason only once
X-Git-Tag: v_3_0_34~85
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/faq/developer-manual/@default-cgi@/static/coding.html?a=commitdiff_plain;h=f0dfc47636316ae1c4ec49e74df8148b8d08aacd;p=privoxy.git

privoxy-log-parser: Highlight the Crunch reason only once

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.
---

diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl
index 905767d2..b511931b 100755
--- a/tools/privoxy-log-parser.pl
+++ b/tools/privoxy-log-parser.pl
@@ -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\]$/) {