#33 record task should allow regular expression filters

open
nobody
None
5
2007-02-22
2007-02-22
matthenry
No

I created my own custom nant task based on the record task which allows you to pass in a regular expression. Any line matching the regular expression is filtered out. This is because Visual Studio and Perforce output tons and tons of useless messages that bloat up my log file to over a meg. Examples of the useless message are that it prints out every single file it successfully compiles. I don't need to know that - I just need to know if a file FAILED to compile. By filtering out the obviously useless junk it cuts my log down to a more readable 200k.

It would be cool if that was built into the normal record task. It's easy to implement it - just add a TaskAttribute called "linesToSkipRegex" and add a parameter to the FileLogListener so it can accept a regex string. Then in FileLogListener's OutputMessage add "if (_linesToSkipRegex.IsMatch(line)) continue;"

The regular expression I use is linesToSkipRegex="^\[p4sync\] (info|exit):|^\w+\.(cpp|h|c)$|Compiling\.\.\.|Generating Code\.\.\."

Also you should add TaskAttribute that allows you to turn off the annoying "[exec]" and "[echo]" prefixes on every line. Again, that is trivial to add, there's already an "emacs mode" on the FileLogListener, you just need to give the user a way to turn it on from the record task.

Discussion