mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 19:57:41 +02:00
Tweaks to exception handler, refs #1012
This commit is contained in:
@@ -15,6 +15,7 @@ use Monolog\Handler\HandlerInterface;
|
|||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\StreamHandler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Psr\Log\InvalidArgumentException;
|
use Psr\Log\InvalidArgumentException;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monolog log channel
|
* Monolog log channel
|
||||||
@@ -346,8 +347,8 @@ class Logger implements LoggerInterface
|
|||||||
|
|
||||||
next($this->handlers);
|
next($this->handlers);
|
||||||
}
|
}
|
||||||
} catch (\Exception $ex) {
|
} catch (Exception $e) {
|
||||||
$this->handleException($ex, $record);
|
$this->handleException($e, $record);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -537,17 +538,14 @@ class Logger implements LoggerInterface
|
|||||||
/**
|
/**
|
||||||
* Delegates exception management to the custom exception handler,
|
* Delegates exception management to the custom exception handler,
|
||||||
* or throws the exception if no custom handler is set.
|
* or throws the exception if no custom handler is set.
|
||||||
*
|
|
||||||
* @param Exception $ex
|
|
||||||
* @param array $record
|
|
||||||
*/
|
*/
|
||||||
protected function handleException(\Exception $ex, $record)
|
protected function handleException(Exception $e, array $record)
|
||||||
{
|
{
|
||||||
if ($this->exceptionHandler) {
|
if (!$this->exceptionHandler) {
|
||||||
call_user_func($this->exceptionHandler, $ex, $record);
|
throw $e;
|
||||||
} else {
|
|
||||||
throw $ex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
call_user_func($this->exceptionHandler, $e, $record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user