[我试图在set_exception_handler
和set_error_handler
中使用Monolog,而外面却鸣叫。
我尝试了2个位置来运行Whoops。
Run Whoops #1 Location
Run Whoops #2 Location
我坚持为什么我无法同时使Monolog和Whoops一起工作。
...
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
error_reporting(E_ALL);
ini_set('display_errors', 1);
//Run Whoops #1 Location
$whoops = new Run();
$whoops->prependHandler(new PrettyPageHandler());
$whoops->register();
function exceptionHandler($e)
{
//log the exception using monolog
}
function errorHandler($errno, $errstr, $errfile, $errline)
{
//log the error using monolog
}
set_error_handler("errorHandler");
set_exception_handler('exceptionHandler');
//Run Whoops #2 Location
$whoops = new \Whoops\Run;
$whoops->pushHandler(function($exception, $inspector, $run) {
// Initialise Monolog here
});