X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=tools%2Fprivoxy-log-parser.pl;h=5ffa00d006ef7584fc259206d7c61e451ba7bb22;hp=dce3b3150d9e445738b107416b436fe8f0eec12b;hb=e18a6a44d67868da0a314cc07a0f6f81d19c7afc;hpb=b5ce79b11f3159a17e6c519b1eb95b50d3fac350 diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index dce3b315..5ffa00d0 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -52,6 +52,7 @@ use constant { CLI_OPTION_DEFAULT_TO_HTML_OUTPUT => 0, CLI_OPTION_TITLE => 'Privoxy-Log-Parser in da house', + CLI_OPTION_KEEP_DATE => 0, CLI_OPTION_NO_EMBEDDED_CSS => 0, CLI_OPTION_NO_MSECS => 0, CLI_OPTION_NO_SYNTAX_HIGHLIGHTING => 0, @@ -107,6 +108,7 @@ my %h_colours; my $header_highlight_regex = ''; my $html_output_mode; +my $keep_date_mode; my $no_msecs_mode; # XXX: should probably be removed my $shorten_thread_ids; my $line_end; @@ -2388,12 +2390,14 @@ sub print_clf_message() { sub print_non_clf_message($) { my $content = shift; + my $date_string = $keep_date_mode ? $req{$t}{'day'} . ' ' : ''; my $msec_string = $no_msecs_mode ? '' : '.' . $req{$t}{'msecs'}; my $line_start = $html_output_mode ? '' : $h{"Standard"}; return if DEBUG_SUPPRESS_LOG_MESSAGES; print $line_start + . $date_string . $time_colours[$time_colour_index % 2] . $req{$t}{'time-stamp'} . $msec_string @@ -2450,6 +2454,7 @@ sub parse_loop() { 'Fatal error' => \&handle_loglevel_ignore, 'Writing' => \&handle_loglevel_ignore, 'Received' => \&handle_loglevel_ignore, + 'Tagging' => \&handle_loglevel_ignore, 'Actions' => \&handle_loglevel_ignore, 'Unknown log level' => \&handle_loglevel_ignore, ); @@ -2547,6 +2552,7 @@ sub stats_loop() { 'Redirect:' => \&handle_loglevel_ignore, 'Unknown log level:' => \&handle_loglevel_ignore, 'Writing:' => \&handle_loglevel_ignore, + 'Tagging:' => \&handle_loglevel_ignore, ); while (<>) { @@ -2611,6 +2617,7 @@ sub get_cli_options() { our %cli_options = ( 'html-output' => CLI_OPTION_DEFAULT_TO_HTML_OUTPUT, 'title' => CLI_OPTION_TITLE, + 'keep-date' => CLI_OPTION_KEEP_DATE, 'no-syntax-highlighting' => CLI_OPTION_NO_SYNTAX_HIGHLIGHTING, 'no-embedded-css' => CLI_OPTION_NO_EMBEDDED_CSS, 'no-msecs' => CLI_OPTION_NO_MSECS, @@ -2627,6 +2634,7 @@ sub get_cli_options() { GetOptions ( 'html-output' => \$cli_options{'html-output'}, 'title' => \$cli_options{'title'}, + 'keep-date' => \$cli_options{'keep-date'}, 'no-syntax-highlighting' => \$cli_options{'no-syntax-highlighting'}, 'no-embedded-css' => \$cli_options{'no-embedded-css'}, 'no-msecs' => \$cli_options{'no-msecs'}, @@ -2644,6 +2652,7 @@ sub get_cli_options() { $html_output_mode = cli_option_is_set('html-output'); $no_msecs_mode = cli_option_is_set('no-msecs'); + $keep_date_mode = cli_option_is_set('keep-date'); $shorten_thread_ids = cli_option_is_set('shorten-thread-ids'); $line_end = get_line_end(); } @@ -2743,6 +2752,9 @@ omitted, ANSI escape sequences are used unless B<--no-syntax-highlighting> is ac This option is only intended to make embedding log excerpts in web pages easier. It does not escape any input! +[B<--keep-date>] Don't remove the date when printing highlighted log messages. +Useful when parsing multiple log files at once. + [B<--no-msecs>] Don't expect milisecond resolution [B<--no-syntax-highlighting>] Disable syntax-highlighting. Useful when