Mercurial > hg > icedrobot > icedrobot
view make/colour-ant @ 2:19d15fc7f077
Add utility to clour ant output.
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Thu, 17 Feb 2011 01:22:47 +0100 |
parents | |
children |
line wrap: on
line source
#!/usr/bin/perl -w # # color-ant 0.9 2001-07-30 meier@o-matic.de # # perl script to give ant nice colors for readabiliy # # Philipp Meier <meier@o-matic.de> # # UPDATED: # # Some regex added by Julian Swagemakers <julian@swagemakers.de> # # # Based on: # # $Id: loco,v 1.1.1.1 2000/12/14 19:52:34 jules Exp $ # # perl script to give /var/log/messages nice colors for readability # # Jules Stuifbergen <jules@zjuul.net> # (I was bored, rewrote 'logcolorise.pl' from Michael Babcock from scratch) # # Thanks Jeffrey Paul <sneak@datavibe.net> for several improvements # Cristian Ionescu-Idbohrn <cii@axis.se> for better patterns use Term::ANSIColor; use strict; $Term::ANSIColor::AUTORESET++; # reset color after each print $SIG{INT} = sub { print "\n"; exit; }; # reset color after Ctrl-C $| = 1; # unbuffer STDOUT; my %rules = ( '^\S+:' => "cyan", '^\s*\[.*?\]\s+' => "blue", # find everything that contains "error" except "error: 0" '[Ee]rror(?!s: 0)(s)?' => "bold red", # find everything that contains "fail" except "failures: 0" '[Ff]ail(?!ures: 0)(ure)?(ed)?(s)?' => "bold red", '(\d+\s*)?([Ww]arnings?|[Ww]arn)' => "yellow", '(\d+\s*)?(CMake?)' => "cyan", 'Exception' => "bold red", 'INFO.*' => "bold", 'ERROR.*' => "red bold", 'FATAL.*' => "blink bold red", 'DEBUG.*' => "clear" ); #### Main loop # while (<>) { study; my $regex; foreach $regex (keys %rules) { s/$regex/colored($&,$rules{$regex})/ge; } print; }