Move exit-stats code to the end of rephist.c.
[tor/rransom.git] / contrib / checkLogs.pl
blobb00503e9abf9161a6188ace11baa1e9ba39d60c6
1 #!/usr/bin/perl -w
3 use strict;
5 my %count = ();
6 my $more = 0;
7 my $last = "";
9 while (<>) {
10 if ($more) {
11 if (/LD_BUG/) {
12 $more = 0;
13 next;
15 if (/\"((?:[^\"\\]+|\\.*)+)\"(.*)/) {
16 $last .= $1;
17 if ($2 !~ /[,\)]/) {
18 $more = 1;
19 } else {
20 $count{lc $last}++;
21 $more = 0;
23 } elsif (/[,\)]/) {
24 $count{lc $last}++;
25 $more = 0;
26 } elsif ($more == 2) {
27 print "SKIPPED more\n";
29 } elsif (/log_(?:warn|err|notice)\(\s*(LD_[A-Z_]*)\s*,\s*\"((?:[^\"\\]+|\\.)*)\"(.*)/) {
30 next if ($1 eq 'LD_BUG');
31 my $s = $2;
32 if ($3 =~ /[,\)]/ ) {
33 $count{lc $s}++;
34 } else {
35 $more = 1;
36 $last = $s;
38 } elsif (/log_(?:warn|err|notice)\(\s*((?:LD_[A-Z_]*)?)(.*)/) {
39 next if ($1 eq 'LD_BUG');
40 my $extra = $2;
41 chomp $extra;
42 $last = "";
43 $more = 2 if ($extra eq '');
47 while ((my $phrase, my $count) = each %count) {
48 if ($count > 1) {
49 print "$count\t$phrase\n";