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

LOGGING STATES

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

EXAMPLE CONFIG FILE

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

AUTHOR

91       Matt Sergeant, matt@sergeant.org
92

BUGS

94       Please use http://rt.cpan.org/ for bugs.
95

LICENSE

97       This is free software. You may use it and redistribute it under the
98       same terms as Perl itself.
99

SEE ALSO

101       Log::Dispatch
102
103       Log::Dispatch::Config
104
105       AppConfig
106
107       POE
108
109
110
111perl v5.8.8                       2002-01-10         POE::Component::Logger(3)
Impressum