X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-mtm.git;a=blobdiff_plain;f=xlog%2Fbin%2Freport;h=f6ea1d160de4d94c87e96b0220e9651d4f3c23e3;hp=aef8458c91932a5d164a0d25ca146a7823fa989d;hb=87c1744952c472b438731e0022c5bcb4709eac3d;hpb=2d4e5294848b9a94620f5d1c1b076b0e799707b7 diff --git a/xlog/bin/report b/xlog/bin/report index aef8458..f6ea1d1 100755 --- a/xlog/bin/report +++ b/xlog/bin/report @@ -1,13 +1,30 @@ #!/usr/bin/perl -w -our ($ng,$staticfiles,@ARGV) = @ARGV; -chdir $ng or die $!; - use strict (qw(vars)); use IO::Handle; use POSIX; use CGI qw/:standard *table end_* -no_xhtml/; +our $timesquash = 3; +# no. of digits at end of time to replace with x, 0..4 + +for (;;) { + last unless @ARGV; + last unless $ARGV[0] =~ m/^-/; + $_ = shift @ARGV; + last if m/^--?$/; + while (m/^-./) { + if (s/^-t([0-4])/-/) { + $timesquash= $1; + } else { + die "bad option $_ ?"; + } + } +} + +our ($ng,$staticfiles,@ARGV) = @ARGV; +chdir $ng or die $!; + our @lines= (); our @s; our $oddeven = "o"; @@ -22,8 +39,11 @@ sub processlog ($$) { chomp; @s= split /\t/; push @s, '' if @s<=6; - $s[0]= strftime "%Y-%m-%d %H:%M %Z", localtime $s[0]; - $s[0] =~ s/(\d+\:\d)\d/${1}x/; + $s[0]= strftime "%Y-%m-%d %H:%M:%S %Z", localtime $s[0]; + for (my $i=0; $i<$timesquash; $i++) { + $s[0] =~ s/(\d\d:[\d:]*)\d/$1x/; + } + $s[0] =~ s/:xx / /; &$processline(); $oddeven =~ y/oe/eo/; }