POE::XUL::Logging - POE::XUL logging
use POE::Component::XUL; use POE::Logging; POE::Component::XUL->spawn( { logging => $destination } ); xlog "I'm doing X"; xwarn "Look at me!" xcarp "You did that!"; xdebug "Something=$something";
POE::XUL::Logging is a singleton object used by POE::XUL to flexibly dispatch log messages, warnings and debug messages in an application-defined manner. The message destination may be a coderef, a logging object (think Log4Perl), a POE session or POE session/event tuple.
An application does not instanciate the POE::XUL::Logging singleton directly. Rather, this is handled by POE::Component::XUL and controled by the logging parameter to "spawn" in POE::Component::XUL.
logging
Each message has a severity level. POE::XUL::Logging defines the following levels, in order of severity: DEBUG, LOG, REQ, WARN. REQ and LOG are synonyms, the difference being that REQ is for logging a static request, equivalent to apache's access_log.
DEBUG
LOG
REQ
WARN
There is also the SETUP psuedo-level which is used when it is time to open or reopen any log files.
SETUP
POE::XUL::Logging is configured by a logger parameter that is passed to POE::Component::XUL's spawn method.
Regardless of the logger being used, each message is encapsulated in a message structure. This structure is a hashref with the following keys:
One of DEBUG, LOG, REQ, WARN or SETUP. A logger is expected to handle the message bassed on this field. DEBUG and WARN messages might ignored in a production server. REQ messages might go to a different file then LOG. SETUP messages are used by POE::Component::XUL to tell the logger to open (or reopen) any log files.
POE::Component::XUL
Text of the message.
Arrayref of the output of "caller" in perlfunc at the relevant caller-frame-level.
A logger may be one of the following:
POE::Component::XUL->spawn( { logging => \&my_log } ); sub my_log { my( $message ) = @_; }
$message is described above.
$message
my $logger = Log::Log4perl->get_logger( "My::Logger" ); POE::Component::XUL->spawn( { logging => $logger } );
All log messages will be dispatched via the object's log method:
log
sub log { my( $level, $message ) = @_; }
$level is the numeric level, compatible with Log::Log4perl. $message is described above.
$level
Note that the object will never be passed a SETUP message.
POE::Component::XUL->spawn( { logging => $_[SESSION]->id } );
All log messages will be dispatched via the sessions's log event:
sub log { my( $self, $message ) = @_[OBJECT, ARG0]; }
POE::Component::XUL->spawn( { logging => [ $session, $event ] );
All log messages will be dispatched to $session's $event state.
$session
$event
sub log_state { my( $heap, $message ) = @_[HEAP, ARG0]; }
xlog "Foo", $biff, " bar";
xwarn "This is going badly";
xcarp "Don't do that";
Same as "xwarn", but caller is one frame higher.
caller
xdebug "Do you care";
Philip Gwyn <gwyn-at-cpan.org>
Based on XUL::Node by Ran Eilam.
Copyright 2007-2010 by Philip Gwyn. All rights reserved;
Copyright 2003-2004 Ran Eilam. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1), POE::XUL, POE::XUL::Node.
To install POE::XUL::RDF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::XUL::RDF
CPAN shell
perl -MCPAN -e shell install POE::XUL::RDF
For more information on module installation, please visit the detailed CPAN module installation guide.