1POE::Component::Logger(U3s)er Contributed Perl DocumentatPiOoEn::Component::Logger(3)
2
3
4

NAME

6       POE::Component::Logger - A POE logging class
7

SYNOPSIS

9       In your startup code somewhere:
10
11         POE::Component::Logger->spawn(ConfigFile => 'log.conf');
12
13       And later in an event handler:
14
15         Logger->log("Something happened!");
16

DESCRIPTION

18       POE::Component::Logger provides a simple logging component that uses
19       Log::Dispatch::Config to drive it, allowing you to log to multiple
20       places at once (e.g. to STDERR and Syslog at the same time) and also to
21       flexibly define your logger's output.
22
23       It is very simple to use, because it creates a Logger::log method (yes,
24       this is namespace corruption, so shoot me). If you don't like this,
25       feel free to post directly to your logger as follows:
26
27         $kernel->post('logger', 'log', "An error occurred: $!");
28
29       In fact you have to use that method if you pass an Alias option to
30       spawn (see below).
31
32       All logging is done in the background, so don't expect immediate output
33       - the output will only occur after control goes back to the kernel so
34       it can process the next event.
35

OPTIONS and METHODS

37   "spawn"
38       The spawn class method can take two options. A required ConfigFile
39       option, which specifies the location of the config file as passed to
40       Log::Dispatch::Config's "configure()" method (note that you can also
41       use an object here, see Log::Dispatch::Config for more details). The
42       other available option is Alias which you can use if you wish to have
43       more than one logger in your POE application.  Note though that if you
44       specify an alias other than the default 'logger' alias, you will not be
45       able to use the "Logger->log" shortcut, and will have to use direct
46       method calls instead.
47
48   "Logger->log" / "POE::Component::Logger->log"
49       This is used to perform a logging action. You may either pass a string,
50       or a hashref. If you pass in a string it is logged at the level
51       specified in $POE::Component::Logger::DefaultLevel, which is 'warning'
52       by default. If you pass in a hashref it is expanded as a hash and
53       passed to Log::Dispatch's "log()" method.
54

LOGGING STATES

56       The following states are available on the POE logging session:
57
58   "log"
59       Same as "Logger->log()", except you may use a different alias if
60       posting direct to the kernel, for example:
61
62         $kernel->post( 'error.log', 'log', "Some error");
63         $kernel->post( 'access.log', 'log', "Access Details");
64
65   "debug"
66       And also "notice", "info", "warning", "error", "critical", "emergency"
67       and "alert".
68
69       These states simply log at a different level. See Log::Dispatch for
70       further details.
71

EXAMPLE CONFIG FILE

73         # logs to screen (STDERR) and syslog
74         dispatchers = screen syslog
75
76         [screen]
77         class = Log::Dispatch::Screen
78         min_level = info
79         stderr = 1
80         format = %d %m %n
81
82         [syslog]
83         class = Log::Dispatch::Syslog
84         min_level = warning
85

SUPPORT

87       You can look for information at:
88
89       •   RT: CPAN's request tracker
90
91           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Logger>:
92           post bug report there.
93
94       •   CPAN Ratings
95
96           <http://cpanratings.perl.org/p/POE-Component-Logger>: if you use
97           this distibution, please add comments on your experience for other
98           users.
99
100       •   Search CPAN
101
102           <http://search.cpan.org/dist/POE-Component-Logger/>
103
104       •   GitHub
105
106           <http://github.com/dolmen/POE-Component-Logger>: the source code
107           repository.
108

AUTHORS

110       Matt Sergeant, "matt@sergeant.org".
111
112       Olivier Mengué, "dolmen@cpan.org".
113
115       Copyright © 2002 Matt Sergeant.
116
117       Copyright © 2010 Olivier Mengué.
118
119       This is free software. You may use it and redistribute it under the
120       same terms as Perl itself.
121

SEE ALSO

123       •   Log::Dispatch
124
125       •   Log::Dispatch::Config
126
127       •   AppConfig
128
129       •   POE
130
131
132
133perl v5.36.0                      2022-07-22         POE::Component::Logger(3)
Impressum