Hi all,

lately I've needed to colorize (or highlight) the lines of some IRC logs.
I've searched on CPAN and apparently there isn't any similar module.
So I wrote a simple script in order to do it.
The output can be in html or to terminal (by using Escape sequences).
The module is very simple but after some little modifies, the module is now
capable to colorize not only IRC logs but all logs (in general all text file)
by defining a custom regex to match lines (maybe in the future, the regex
for known log formats can be included into the distro). 
I've searched on CPAN and apparently there isn't any similar modules.
So, I decided to package it and if someone think that will be useful, I 
will put it into CPAN. :-)

Simple API usage: 

---
use Log::Colorize;
my $log = new Log::Colorize( 
   'file-in' => 'log.txt',    # default is STDIN
   'file-out' => 'log.html',  # default is STDOUT
   # custom regex for a IRC-like log
   'regex' => '(\d\d:\d\d)?\s*(<@|<|<\+|\*)\s*(\w+)\s*(>)?'
);
$log->colorize;
---

You can get the module (still in alpha, but working) here:

        http://pisa.pm.org/log-colorize/Log-Colorize-0.01.tar.gz

(sample output are in http://pisa.pm.org/log-colorize/apache.html
and http://pisa.pm.org/log-colorize/irc.html)

I've called it Log::Colorize, but any suggestions about the module and/or 
namespace (for example Log::Highlight) are welcome. 
Thanks in advance.

by

        - Enrico

Reply via email to