Log::Any::Plugin::ANSIColor - Auto-colorize Log::Any logs with Term::ANSIColor


    use Log::Any::Adapter 'Stderr';     # Choose any adapter that makes sense

    use Log::Any::Plugin;
    Log::Any::Plugin->add('ANSIColor'); # Use the default colorscheme

    # In this or any other module
    use Log::Any qw( $log );

    $log->alert('Call the police!');    # Prints as red on white


Log::Any::Plugin::ANSIColor automatically applies ANSI colors to log messages depending on the log level.

For example, with the default colorscheme, error logs are red, warning logs are yellow.

If a given log level has no coloring, the original log method is left intact, and incurs no overhead.


Adding the plugin with no extra arguments gives the default colorscheme.


Note that info and notice messages have no special coloring in the default colorscheme.

Specify some colors to completely replace the default colorscheme. Only the specified colors are applied.

            error   => 'white on_red',
            warning => 'black on_yellow',

Use default => 1 to include the default colorscheme with customisations. Default colors can be switched off by specifying 'none' as the color.

            default => 1,               # use default colors
            error   => 'white on_red',  # override error color
            warning => 'none',          # turn off warning color

Valid colors are any strings acceptable to colored in Term::ANSIColor. eg. 'blue' 'bright_red on_white


Copyright (C) Stephen Thirlwall.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Stephen Thirlwall <>