Log::ger::Output::Screen - Output log to screen
version 0.019
use Log::ger::Output Screen => ( # stderr => 1, # set to 0 to print to stdout instead of stderr # use_color => 0, # set to 1/0 to force usage of color, default is from NO_COLOR/COLOR or (-t STDOUT) # color_depth => 16, # if unset will guess from heuristic # colorize_tags => 0, # if set to true, will colorize "[...]" prefix in log message to unique colors # formatter => sub { ... }, ); use Log::ger; log_warn "blah...";
This Log::ger plugin outputs log messages as lines to screen (STDERR by default), coloring them according to the log messages' levels. There are different color schemes available, see Log::ger::Screen::ColorScheme::* modules like Log::ger::Screen::ColorScheme::Unlike.
Log::ger::Screen::ColorScheme::*
Bool, default 1. Whether to print to STDERR (the default) or STDOUT.
Bool. The default is to look at the NO_COLOR and COLOR environment variables, or 1 when in interactive mode and 0 when not in interactive mode.
Integer, either 0, 16, 256, or 16777216. If unset, will use the following heuristic to guess color depth of terminal. First, if "use_color" is false then 0. Otherwise, check if COLORTERM environment variable is defined and has the value of truecolor; if yes then use 16777216. Otherwise, check if TERM environment variable contains the string 256color; if yes then 256. Otherwise 16.
truecolor
256color
Bool, default false. Experimental. If set to true, will colorize "[...]" tag prefixes in log message with unique RGB color. Will only do this if color is enabled, obviously. This option is inspired by Dist::Zilla terminal output.
For example, if log message is something like one of the following:
[pericmd][plugin Foo::Bar] skip foobar-ing the program because of qux my-prog: [pericmd] [plugin Foo::Bar] skip foobar-ing the program because of qux
Then the [pericmd] and [plugin Foo::Bar] will be given a unique RGB color each.
[pericmd]
[plugin Foo::Bar]
Coderef. When defined, will pass the formatted message (but being applied with colors) to this custom formatter.
Will be used as a default for "color_depth" configuration.
Can be set (to anything) to disable color by default, if /use_color is not set. Consulted before "COLOR".
/use_color
Can be set to disable/enable color by default, if /use_color is not set.
Originally modelled after Log::Any::Adapter::Screen.
Log::ger
perlancar <perlancar@cpan.org>
This software is copyright (c) 2022, 2021, 2020, 2018, 2017 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Log::ger::Output::Screen, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::ger::Output::Screen
CPAN shell
perl -MCPAN -e shell install Log::ger::Output::Screen
For more information on module installation, please visit the detailed CPAN module installation guide.