Guide Home
POD Home

Sloop::Logger::ANSIcolor

DESCRIPTION

A version of Sloop::Logger which uses ANSI escapes to color the output. This is probably not desirable if you are logging to a file since the escape sequences add clutter if viewed with that does not process them as ANSI. Output to a normal linux terminal though is of course fine.

Three colors are used, one for each element of the 'logs' array (see Sloop::Logger).

The colors aren't applied to the timestamp.

REQUIRES

This refers only to things not part of Sloop or the perl core.

Term::ANSIColor

SYNOPSIS

 my $logger = Sloop::Logger::ANSIcolor->new (
     $colors,
     logs => (optional), see Sloop::Logger
 );

$colors is a array reference with three elements. These are passed through to Term::ANSIColor. For example:

 [ 'red', 'green, 'blue' ]

These parallel the 'logs' array. The color specification is as per Term::ANSIColor, including the use of `bold`, `on_` (for foreground/background combinations) and `grey` and `rgb` specs for 256 color terminals.