Hello Ant-Users,
I've hacked together a little perl script which will
colorize ant's output. It's tested on linux and I like
it:
----- snipp -----
#!/usr/bin/perl -w
#
# color-ant 0.9 2001-07-30 [EMAIL PROTECTED]
#
# perl script to give ant nice colors for readabiliy
#
# Philipp Meier <[EMAIL PROTECTED]>
#
# 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 <[EMAIL PROTECTED]>
# (I was bored, rewrote 'logcolorise.pl' from Michael Babcock from scratch)
#
# Thanks Jeffrey Paul <[EMAIL PROTECTED]> for several improvements
# Cristian Ionescu-Idbohrn <[EMAIL PROTECTED]> 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;
# 'palette'
my $date_color = "cyan";
my $host_color = "magenta";
my $service_color = "blue";
my $alert_color = "red";
my $warn_color = "yellow";
my $good_color = "green";
my $alert_word_color = "bold red";
my $warn_word_color = "yellow";
my $good_word_color = "green";
my %rules = (
'^\S+:' => "cyan",
'^\s*\[.*\]\s+' => "blue",
'(\d+\s*)?(error|failure)s?' => "bold red",
'fail(ed)?' => "bold red",
'(\d+\s*)?(warnings?|warn)' => "red",
'[./]\S*/\S*(:\d+)?:?' => "green",
);
#### Main loop
#
while (<>) {
study;
my $regex;
foreach $regex (keys %rules) {
s/$regex/colored($&,$rules{$regex})/gie;
}
print;
}
--- snip ---
my $0.02
-billy.
--
Philipp Meier o-matic GmbH
Geschäftsführer Pfarrer-Weiß-Weg 16-18
Tel.: +49-(0)700-66284236 89077 Ulm
PGP signature