GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  POE::COMPONENT::LOGGER (3)

.ds Aq ’

NAME

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

CONTENTS

SYNOPSIS

In your startup code somewhere:



  POE::Component::Logger->spawn(ConfigFile => log.conf);



And later in an event handler:



  Logger->log("Something happened!");



DESCRIPTION

POE::Component::Logger provides a simple logging component that uses Log::Dispatch::Config to drive it, allowing you to log to multiple places at once (e.g. to STDERR and Syslog at the same time) and also to flexibly define your logger’s output.

It is very simple to use, because it creates a Logger::log method (yes, this is namespace corruption, so shoot me). If you don’t like this, feel free to post directly to your logger as follows:



  $kernel->post(logger, log, "An error occurred: $!");



In fact you have to use that method if you pass an Alias option to spawn (see below).

All logging is done in the background, so don’t expect immediate output - the output will only occur after control goes back to the kernel so it can process the next event.

OPTIONS and METHODS

CWspawn

The spawn class method can take two options. A required <B>ConfigFileB> option, which specifies the location of the config file as passed to Log::Dispatch::Config’s configure() method (note that you can also use an object here, see Log::Dispatch::Config for more details). The other available option is <B>AliasB> which you can use if you wish to have more than one logger in your POE application. Note though that if you specify an alias other than the default ’logger’ alias, you will not be able to use the Logger->log shortcut, and will have to use direct method calls instead.

CWLogger->log / CWPOE::Component::Logger->log

This is used to perform a logging action. You may either pass a string, or a hashref. If you pass in a string it is logged at the level specified in $POE::Component::Logger::DefaultLevel, which is ’warning’ by default. If you pass in a hashref it is expanded as a hash and passed to Log::Dispatch’s log() method.

LOGGING STATES

The following states are available on the POE logging session:

CWlog

Same as Logger->log(), except you may use a different alias if posting direct to the kernel, for example:



  $kernel->post( error.log, log, "Some error");
  $kernel->post( access.log, log, "Access Details");



CWdebug

And also notice, info, warning, error, critical, emergency and alert.

These states simply log at a different level. See Log::Dispatch for further details.

EXAMPLE CONFIG FILE



  # logs to screen (STDERR) and syslog
  dispatchers = screen syslog

  [screen]
  class = Log::Dispatch::Screen
  min_level = info
  stderr = 1
  format = %d %m %n

  [syslog]
  class = Log::Dispatch::Syslog
  min_level = warning



SUPPORT

You can look for information at:
o RT: CPAN’s request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Logger>: post bug report there.

o CPAN Ratings

<http://cpanratings.perl.org/p/POE-Component-Logger>: if you use this distibution, please add comments on your experience for other users.

o Search CPAN

<http://search.cpan.org/dist/POE-Component-Logger/>

o GitHub

<http://github.com/dolmen/POE-Component-Logger>: the source code repository.

AUTHORS

Matt Sergeant, matt@sergeant.org.

Olivier Mengue\k:'dolmen@cpan.org.

COPYRIGHT & LICENSE

Copyright X 2002 Matt Sergeant.

Copyright X 2010 Olivier Mengue\k:'\h |\n:u.

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

SEE ALSO

o Log::Dispatch
o Log::Dispatch::Config
o AppConfig
o POE
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 POE::COMPONENT::LOGGER (3) 2010-10-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.