An Anonymous Monk asked how to do something like this recently. Since there seems to be some demand for such a thing, and I was already working on it, here it is.

It prints:
A summary of errors and warnings, success and failure;
Projects with warnings, sorted most-warnings-first;
A list of successful projects;
A list of failed projects;
Every line that refers to "error" or "warning".

Many thanks to BrowserUK and many other monks for help with the GRT. Happy compiling...

use warnings; use strict; my $msg; my $errors = 0; my $warnings =0; my $failures = 0; my $success = 0; my @goodProjects; my @badProjects; open (LOG, "log.log") or die "Could not open log file: $!\n"; open (OUT, ">logSummary.txt") or die "Could not open output file: $!\n"; my @msgs = <LOG>; foreach $msg(@msgs) { if ($msg =~ ": error") { $errors++; } if ($msg =~ ": warning") { $warnings++; } if (($msg =~ "error") and ($msg =~ "warning") and !($msg =~ "0 err +or")) { $failures++; push @badProjects, $msg; } if ($msg =~ "0 error") { $success++; push @goodProjects, $msg; } } #Guttman-Rosler Transform! my @sorted = map{ substr $_, 5; }sort { $b cmp $a } map{ m[,\s+(\d+)] ? sprintf '%05d%s', $1, $_ : () } @msgs; #End GRT print OUT "\nBuild had approximately $errors errors.\n"; print OUT "Build had approximately $warnings warnings.\n"; print OUT "$failures projects failed to build.\n"; print OUT "$success projects built successfully.\n\n"; print OUT "Projects sorted according to number of warnings:\n"; foreach my $warning(@sorted) { print OUT $warning unless ($warning =~ ", 0 warning"); } print OUT "\n\n"; print OUT "$success Successful projects:\n"; print OUT "@goodProjects"; print OUT "\n\n"; print OUT "$failures Failed projects:\n"; print OUT "@badProjects"; print OUT "\n\n"; print OUT "Detailed information about errors and warnings follows:\n\n +"; foreach $msg(@msgs) { if (($msg =~ "error") or ($msg =~ "warning")) { print OUT $msg; } }

Replies are listed 'Best First'.
Re: Useful information from Visual Studio compiler logs.
by eyepopslikeamosquito (Archbishop) on May 27, 2004 at 13:59 UTC

    #Guttman-Rosler Transform! my @sorted = map{ substr $_, 5; }sort { $b cmp $a } map{ m[,\s+(\d+)] ? sprintf '%05d%s', $1, $_ : () } @msgs; #End GRT

    As confirmed here this is not a GRT. To qualify as a GRT, it must have a bald sort block. It's the bald sort block that gives the GRT a speed edge over its Schwartzian Transform cousin. See also Advanced Sorting - GRT - Guttman Rosler Transform.

      BTW, $a <=> $b, $b <=> $a, $a cmp $b, $b cmp $a, and no expilcit comparator should be all the same speed in recent perls. (But I'm too lazy to benchmark.)

      Oh, well. It *started off* as a GRT. It still works nice. =)