mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-10 15:14:14 +02:00
Also prevent throwing another exception in the case that the exception logger level is not set.
Also prevent throwing another exception in the case that the exception logger level is not set.
This commit is contained in:
@@ -72,7 +72,7 @@ class ErrorHandler
|
|||||||
public function registerExceptionHandler($level = null, $callPrevious = true)
|
public function registerExceptionHandler($level = null, $callPrevious = true)
|
||||||
{
|
{
|
||||||
$prev = set_exception_handler(array($this, 'handleException'));
|
$prev = set_exception_handler(array($this, 'handleException'));
|
||||||
$this->uncaughtExceptionLevel = $level === null ? LogLevel::ERROR : $level;
|
$this->uncaughtExceptionLevel = $level;
|
||||||
if ($callPrevious && $prev) {
|
if ($callPrevious && $prev) {
|
||||||
$this->previousExceptionHandler = $prev;
|
$this->previousExceptionHandler = $prev;
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,11 @@ class ErrorHandler
|
|||||||
*/
|
*/
|
||||||
public function handleException(\Exception $e)
|
public function handleException(\Exception $e)
|
||||||
{
|
{
|
||||||
$this->logger->log($this->uncaughtExceptionLevel, 'Uncaught exception', array('exception' => $e));
|
$this->logger->log(
|
||||||
|
$this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel,
|
||||||
|
'Uncaught exception',
|
||||||
|
array('exception' => $e)
|
||||||
|
);
|
||||||
|
|
||||||
if ($this->previousExceptionHandler) {
|
if ($this->previousExceptionHandler) {
|
||||||
call_user_func($this->previousExceptionHandler, $e);
|
call_user_func($this->previousExceptionHandler, $e);
|
||||||
|
Reference in New Issue
Block a user