mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-07 13:46:38 +02:00
Merge remote-tracking branch 'origin/master'
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;
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ class ErrorHandler
|
|||||||
register_shutdown_function(array($this, 'handleFatalError'));
|
register_shutdown_function(array($this, 'handleFatalError'));
|
||||||
|
|
||||||
$this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize);
|
$this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize);
|
||||||
$this->fatalLevel = $level === null ? LogLevel::ALERT : $level;
|
$this->fatalLevel = $level;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function defaultErrorLevelMap()
|
protected function defaultErrorLevelMap()
|
||||||
@@ -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);
|
||||||
@@ -157,7 +161,7 @@ class ErrorHandler
|
|||||||
$lastError = error_get_last();
|
$lastError = error_get_last();
|
||||||
if ($lastError && in_array($lastError['type'], self::$fatalErrors)) {
|
if ($lastError && in_array($lastError['type'], self::$fatalErrors)) {
|
||||||
$this->logger->log(
|
$this->logger->log(
|
||||||
$this->fatalLevel,
|
$this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel,
|
||||||
'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'],
|
'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'],
|
||||||
array('file' => $lastError['file'], 'line' => $lastError['line'])
|
array('file' => $lastError['file'], 'line' => $lastError['line'])
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user