Log::Log4perl::Appender::ScreenColoredLevel - Colorize messages according to level
use Log::Log4perl qw(:easy); Log::Log4perl->init(\ <<'EOT'); log4perl.category = DEBUG, Screen log4perl.appender.Screen = \ Log::Log4perl::Appender::ScreenColoredLevels log4perl.appender.Screen.layout = \ Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen.layout.ConversionPattern = \ %d %F{1} %L> %m %n EOT # Appears black DEBUG "Debug Message"; # Appears green INFO "Info Message"; # Appears blue WARN "Warn Message"; # Appears magenta ERROR "Error Message"; # Appears red FATAL "Fatal Message";
This appender acts like Log::Log4perl::Appender::Screen, except that it colorizes its output, based on the priority of the message sent.
The color scheme is
Black
Green
Blue
Magenta
Red
The constructor new() takes an optional parameter stderr, if set to a true value, the appender will log to STDERR. If stderr is set to a false value, it will log to STDOUT. The default setting for stderr is 1, so messages will be logged to STDERR by default.
new()
stderr
Mike Schilli <log4perl@perlmeister.com>, 2004
To install Log::Log4perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Log4perl
CPAN shell
perl -MCPAN -e shell install Log::Log4perl
For more information on module installation, please visit the detailed CPAN module installation guide.