Mercurial > hg > icedrobot > icedrobot
changeset 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 | 337c19469944 |
children | 16fabbbe6121 |
files | make/colour-ant |
diffstat | 1 files changed, 60 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/colour-ant Thu Feb 17 01:22:47 2011 +0100 @@ -0,0 +1,60 @@ +#!/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; +} \ No newline at end of file