On Sun, Sep 28, 2008 at 12:48 PM, Laurent Laville
<pear@laurent-laville.org> wrote:
On my current professional project, I used the FirePHP extension for Firefox
[1] to help me to debug my source code.
Even if don't use PEAR on my project, I think it could be a good idea to
include a such driver for PEAR::Log package.
I've made today a prototype of such driver which support all FirePHP
features.
My question is simple : to share my work with the community, should I wrote
a PEPR proposal or just work with Jon Parise to include in its package for a
future release ?
Just for the record, Christoph Dorn, primary developer on FirePHP, has
written a FirePHP log writer for Zend_Log in Zend Framework. Have you
investigated it, and, if so, how would your approach differ (other than
the obvious fact that it targets PEAR::Log)?
Hi Matthew,
I did not have a deep look for Zend_Log in Zend_Framework (and of course with FirePHP) but approach with PEAR::Log is something equivalent.
My proposal (read by Jon Parise, who've already contacted me) work as any other Log drivers.
Of course if you don't have PEAR::Log available/installed, it's not necessary to have a look on this new driver. Otherwise, I think this firePHP driver will give more power than the firebug driver of PEAR::Log
Don't hesitate to read the roadmap of Christoph Dorn to see what he expect to add to his driver. I think its marvellous, and certainly a great knife-tool for developpers
Here are an example :
<?php
require 'Log.php';
$logger = &Log::singleton('firephp', '', 'ident');
$logger->log("Hello World");
$logger->log("Log message", null, "Log message label");
$logger->log("Info message", PEAR_LOG_INFO, "Info message label");
$logger->log("Warning message", PEAR_LOG_WARNING, "Warning message label");
$logger->log("Error message", PEAR_LOG_ERR, "Error message label");
function test($Arg1) {
throw new Exception('Test Exception');
}
try {
test(array('Hello'=>'World'));
} catch(Exception $e) {
/* Log exception including stack trace & variables */
$logger->log($e, PEAR_LOG_ERR);
}
$logger->log("Backtrace to here", PEAR_LOG_DEBUG, FirePHP::TRACE);
$logger->log(array('2 SQL queries took 0.06 seconds',
array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),
null, FirePHP::TABLE);
$logger->log(apache_request_headers(), PEAR_LOG_DEBUG, "RequestHeaders", FirePHP::DUMP);
?>