Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 14, 2013
2 parents 5a96200 + e8f7aee commit 6225b22
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Monolog/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function register(LoggerInterface $logger, $errorLevelMap = array(
public function registerExceptionHandler($level = null, $callPrevious = true)
{
$prev = set_exception_handler(array($this, 'handleException'));
$this->uncaughtExceptionLevel = $level === null ? LogLevel::ERROR : $level;
$this->uncaughtExceptionLevel = $level;
if ($callPrevious && $prev) {
$this->previousExceptionHandler = $prev;
}
Expand All @@ -92,7 +92,7 @@ public function registerFatalHandler($level = null, $reservedMemorySize = 20)
register_shutdown_function(array($this, 'handleFatalError'));

$this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize);
$this->fatalLevel = $level === null ? LogLevel::ALERT : $level;
$this->fatalLevel = $level;
}

protected function defaultErrorLevelMap()
Expand Down Expand Up @@ -121,7 +121,11 @@ protected function defaultErrorLevelMap()
*/
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) {
call_user_func($this->previousExceptionHandler, $e);
Expand Down Expand Up @@ -157,7 +161,7 @@ public function handleFatalError()
$lastError = error_get_last();
if ($lastError && in_array($lastError['type'], self::$fatalErrors)) {
$this->logger->log(
$this->fatalLevel,
$this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel,
'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'],
array('file' => $lastError['file'], 'line' => $lastError['line'])
);
Expand Down

0 comments on commit 6225b22

Please sign in to comment.