Reputation: 677
I'm not sure how to get FirePHP to catch errors and warnings and report them in the Firebug console.
I've installed FirePHP and I'm pretty sure it is working—I see responses from these in the console:
fb('Log message', FirePHP::LOG);
fb('Info message', FirePHP::INFO);
fb('Warn message', FirePHP::WARN);
fb('Error message', FirePHP::ERROR);
I basically see "Log message," "Info message", "Warn message" and "Error message." I then changed my code to intentionally break it--IT gave this to me from their logs:
[21-Jan-2013 22:19:49] PHP Warning: Missing argument 3 for
echo_first_image(), called in
/app/web/xxx/wp-content/themes/xxx/home.php on
line 85 and defined in
/app/web/xxx/wp-content/themes/xxx/functions.php
on line 12
I'm trying to catch and print this in FirePHP but it is not being detected, and I'm not sure why. My full code block for initializing FirePHP:
<?php /* debug */
require_once("debug/FirePHP.class.php");
require_once('debug/fb.php');
$firephp = FirePHP::getInstance(true);
ob_start();
fb('Log message', FirePHP::LOG);
fb('Info message', FirePHP::INFO);
fb('Warn message', FirePHP::WARN);
fb('Error message', FirePHP::ERROR);
?>
An explanation or resource would be helpful. Thanks!
Upvotes: 0
Views: 736
Reputation: 2581
To do that you need to convert the errors into exceptions.
from FirePHP website:
Error, Exception & Assertion Handling
Convert E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE and E_RECOVERABLE_ERROR errors to ErrorExceptions and send all Exceptions to Firebug automatically if desired.
Assertion errors can be converted to exceptions and thrown if desired.
You can also manually send caught exceptions to Firebug.
$firephp->registerErrorHandler(
$throwErrorExceptions=false);
$firephp->registerExceptionHandler();
$firephp->registerAssertionHandler(
$convertAssertionErrorsToExceptions=true,
$throwAssertionExceptions=false);
try {
throw new Exception('Test Exception');
} catch(Exception $e) {
$firephp->error($e); // or FB::
}
Upvotes: 1