1Appender::ScreenColoredULseevrelCso(n3t)ributed Perl DocAupmpeenntdaetri:o:nScreenColoredLevels(3)
2
3
4

NAME

6       Log::Log4perl::Appender::ScreenColoredLevels - Colorize messages
7       according to level
8

SYNOPSIS

10           use Log::Log4perl qw(:easy);
11
12           Log::Log4perl->init(\ <<'EOT');
13             log4perl.category = DEBUG, Screen
14             log4perl.appender.Screen = \
15                 Log::Log4perl::Appender::ScreenColoredLevels
16             log4perl.appender.Screen.layout = \
17                 Log::Log4perl::Layout::PatternLayout
18             log4perl.appender.Screen.layout.ConversionPattern = \
19                 %d %F{1} %L> %m %n
20           EOT
21
22             # Appears black
23           DEBUG "Debug Message";
24
25             # Appears green
26           INFO  "Info Message";
27
28             # Appears blue
29           WARN  "Warn Message";
30
31             # Appears magenta
32           ERROR "Error Message";
33
34             # Appears red
35           FATAL "Fatal Message";
36

DESCRIPTION

38       This appender acts like Log::Log4perl::Appender::Screen, except that it
39       colorizes its output, based on the priority of the message sent.
40
41       You can configure the colors and attributes used for the different
42       levels, by specifying them in your configuration:
43
44           log4perl.appender.Screen.color.TRACE=cyan
45           log4perl.appender.Screen.color.DEBUG=bold blue
46
47       You can also specify nothing, to indicate that level should not have
48       coloring applied, which means the text will be whatever the default
49       color for your terminal is.  This is the default for debug messages.
50
51           log4perl.appender.Screen.color.DEBUG=
52
53       You can use any attribute supported by Term::ANSIColor as a
54       configuration option.
55
56           log4perl.appender.Screen.color.FATAL=\
57               bold underline blink red on_white
58
59       The commonly used colors and attributes are:
60
61       attributes
62           BOLD, DARK, UNDERLINE, UNDERSCORE, BLINK
63
64       colors
65           BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE
66
67       background colors
68           ON_BLACK, ON_RED, ON_GREEN, ON_YELLOW, ON_BLUE, ON_MAGENTA,
69           ON_CYAN, ON_WHITE
70
71       See Term::ANSIColor for a complete list, and information on which are
72       supported by various common terminal emulators.
73
74       The default values for these options are:
75
76       Trace
77           Yellow
78
79       Debug
80           None (whatever the terminal default is)
81
82       Info
83           Green
84
85       Warn
86           Blue
87
88       Error
89           Magenta
90
91       Fatal
92           Red
93
94       The constructor new() takes an optional parameter "stderr", if set to a
95       true value, the appender will log all levels to STDERR.  If "stderr" is
96       set to a false value, it will log all levels to STDOUT. Otherwise,
97       "stderr" may be set to a hash, with a key for each "log4p_level" and a
98       truthy value to dynamically use stderr.  The default setting for
99       "stderr" is 1, so all messages will be logged to STDERR by default.
100
101           # All messages/levels to STDERR
102           my $app = Log::Log4perl::Appender::Screen->new(
103               stderr  => 1,
104           );
105
106           # Only ERROR and FATAL to STDERR (case-sensitive)
107           my $app = Log::Log4perl::Appender::Screen->new(
108               stderr  => { ERROR => 1, FATAL => 1},
109           );
110
111       The constructor can also take an optional parameter "color", whose
112       value is a  hashref of color configuration options, any levels that are
113       not included in the hashref will be set to their default values.
114
115   Using ScreenColoredLevels on Windows
116       Note that if you're using this appender on Windows, you need to fetch
117       Win32::Console::ANSI from CPAN and add
118
119           use Win32::Console::ANSI;
120
121       to your script.
122

LICENSE

124       Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess
125       <cpan@goess.org>.
126
127       This library is free software; you can redistribute it and/or modify it
128       under the same terms as Perl itself.
129

AUTHOR

131       Please contribute patches to the project on Github:
132
133           http://github.com/mschilli/log4perl
134
135       Send bug reports or requests for enhancements to the authors via our
136
137       MAILING LIST (questions, bug reports, suggestions/patches):
138       log4perl-devel@lists.sourceforge.net
139
140       Authors (please contact them via the list above, not directly): Mike
141       Schilli <m@perlmeister.com>, Kevin Goess <cpan@goess.org>
142
143       Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens
144       Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse
145       Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis
146       Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier  David
147       Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter,
148       Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars
149       Thegler, David Viner, Mac Yang.
150
151
152
153perl v5.36.0                      2023-01-20  Appender::ScreenColoredLevels(3)
Impressum