Catalyst::Plugin::FirePHP - sends Catalyst log messages to a FirePHP console
In your application class (e.g. MyApp.pm):
use Catalyst ( ..., '+Catalyst::Plugin::FirePHP' ); use Catalyst::Log::Log4perl; __PACKAGE__->config( name => 'Just a Catalyst application', FirePHP => { action_grouping => 1, compact => 1 } ); # only if you want to change the appender layout to use cspecs __PACKAGE__->log( Catalyst::Log::Log4perl->new( 'log4perl.conf', override_cspecs => 1 ));
In your log4perl config (only if you want to change the message layout):
log4perl.rootLogger = DEBUG, SCREEN, FIREPHP log4perl.appender.SCREEN = Log::Log4perl::Appender::Screen log4perl.appender.SCREEN.layout = SimpleLayout log4perl.appender.FIREPHP = FirePHP::Log4perl::Appender log4perl.appender.FIREPHP.layout = FirePHP::Log4perl::Layout
And later...
$c->log->debug("This is using log4perl AND FirePHP!");
Catalyst::Plugin::FirePHP automatically binds the current response headers to a newly created FirePHP::Dispatcher in use and on demand creates nested groups for all called actions.
The only thing you need to do to start using FirePHP is include this plugin in your plugin list. Everything else should happen automatically, no config is needed.
This plugin tries to be as unintrusive as possible if your application doesn't run in debug mode, but it is highly recommended to drop it altogether in production servers.
Direct access to the FirePHP::Dispatcher in use. Returns a Class::BlackHole instance if none is available so doesn't blow up your application in case you forget to call it conditionally as in
$c->firephp_log->info( 'Foo' ) if $c->firephp_log;
After setup_components is executed this plugin tries to amend or hijack the logger and create a suitable log connector, defaulting to FirePHP::LogConnector::Catalyst::Log which replaces the original logger and tries to forward as much as possible.
Small wrapper that delegates all the work to the log connector if FirePHP logging is enabled. If not, the normal call chain is resumed
Unfortunatly log connectors are responsible to ensure that the log is flushed after the dispatch cycle ends. This can not easily be changed due to various scoping issues.
Implements action grouping
Access to the FirePHP::LogConnector in use. This might return a FirePHP::LogConnector::Null in later versions. Right now, it defaults to FirePHP::LogConnector::Catalyst::Log regardless of debug mode.
Plenty, I guess. This is a pre-release version of Catalyst::Plugin::FirePHP and hasn't seen wide-spread testing.
This code is in Github:
git://github.com/willert/firephp-perl.git
A small wiki with sample screenshots is available at:
L<http://wiki.github.com/willert/firephp-perl>
http://www.firephp.org, Catalyst, FirePHP::Dispatcher
Sebastian Willert, willert@cpan.org
willert@cpan.org
Copyright 2009 by Sebastian Willert <willert@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Plugin::FirePHP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::FirePHP
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::FirePHP
For more information on module installation, please visit the detailed CPAN module installation guide.