Very very nice..

I have added the following to the writer class to allow for stack-traces in the Zend_Log_Writer_FirePHP:
(added below the   "switch($event['priority'])" statement)

       if ($event['message'] instanceof Exception) {
           $event['message'] = array('Class'=>get_class($event['message']),
'Message'=>$event['message']->getMessage(),
                                      'File'=>$event['message']->getFile(),
                                      'Line'=>$event['message']->getLine(),
'Trace'=>$event['message']->getTrace()
                                     );
           $type = 'TRACE';
       }

Furthermore, I have added the logger to the default ErrorController (in the ErrorAction method): (Zend_Framework Manual: http://framework.zend.com/manual/en/zend.controller.plugins.html#zend.controller.plugins.standard.errorhandler "7.10.5.2.1. Using the ErrorHandler as a 404 Handler")

$errors = $this->_getParam('error_handler');
Zend_Registry::get('logger')->err($errors->exception);

[The logger goes in the registry in the bootstrap file]

And added the Suppress filter in the bootstrap to make sure the errors only get outputted in a non-live environment:

$writer = new F500_Log_Writer_FirePHP();
$logger = new Zend_Log($writer);
$filter = new Zend_Log_Filter_Suppress();
$filter->suppress($live);
$logger->addFilter($filter);

[ Note the rename of the class Zend_Log_Writer_FirePHP - as not to conflict with the Zend namespace, at least for now)]

This makes it unnececary to debug to the browser screen (ever) so:
$front->throwExceptions(!$live);

becomes:
$front->throwExceptions(false);


And I'm a happy camper :-)

--
Ramon de la Fuente
Future500 BV

Graaf Janstraat 143
2713 CK ZOETERMEER
tel: +31(0) 79 3164428
fax: +31(0) 84 7160626
mob: +31(0) 6 53443008

@: [EMAIL PROTECTED]
w: www.future500.nl




Christoph Dorn wrote:
I've installed it - took about 4 minutes to get up-and-running... I love
it already! Debugging without breaking the application output - it is
exactly what the doctor ordered!*grin*


I have just put up an update that allows you to browse the full stack
trace of any PHP exception including variables in Firebug. Simply log
exceptions with:

try {
  ...
} catch(Exception $e) {
  fb($e);
}

There is a screenshot of how this looks in the Console here:
http://www.firephp.org/

Let me know what you think.

Christoph

Reply via email to