From 466057c797ea62fff5d0cda25a00c67d4c5ef4ca Mon Sep 17 00:00:00 2001 From: Hany el-Kerdany Date: Fri, 25 Jul 2014 10:36:35 +0200 Subject: [PATCH] Add 'code', 'message' to ErrorHandler log context. Passed the 'code' and 'message' from the original error/fatal-error to the context of ErrorHandler log record(s). This will help writers of Handlers to save structured information about errors/fatal-errors. (e.g. Useful for a "DatabaseHandler"). --- src/Monolog/ErrorHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Monolog/ErrorHandler.php b/src/Monolog/ErrorHandler.php index f9cca004..c8923354 100644 --- a/src/Monolog/ErrorHandler.php +++ b/src/Monolog/ErrorHandler.php @@ -142,7 +142,7 @@ class ErrorHandler } $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL; - $this->logger->log($level, self::codeToString($code).': '.$message, array('file' => $file, 'line' => $line)); + $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); if ($this->previousErrorHandler === true) { return false; @@ -163,7 +163,7 @@ class ErrorHandler $this->logger->log( $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel, 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], - array('file' => $lastError['file'], 'line' => $lastError['line']) + array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line']) ); } }