From dbbb0c2f1317b0c6c1eba883dfca05ba56a2f5b6 Mon Sep 17 00:00:00 2001 From: kremsy Date: Mon, 17 Feb 2014 12:54:31 +0100 Subject: [PATCH] trigger debug notice possability --- application/core/ErrorHandler.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index d10ea317..9449eed8 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -11,6 +11,11 @@ use ManiaControl\Update\UpdateManager; * @author steeffeen & kremsy */ class ErrorHandler { + /** + * Constants + */ + const MC_DEBUG_NOTICE = "ManiaControl.DebugNotice"; + /** * Private Properties */ @@ -94,7 +99,6 @@ class ErrorHandler { logMessage($message); if ($errorNumber != E_USER_ERROR && $errorNumber != E_USER_WARNING && $errorNumber != E_USER_NOTICE) { - $error = array(); $error["Type"] = "Error"; $error["Message"] = $message; @@ -135,6 +139,17 @@ class ErrorHandler { return false; } + /** + * Triggers a Debug Notice to the ManiaControl Website + * + * @param $message + */ + public function triggerDebugNotice($message) { + $backtrace = debug_backtrace(); + $callee = next($backtrace); + $this->errorHandler(self::MC_DEBUG_NOTICE, $message, $callee['file'], $callee['line']); + } + /** * Get the prefix for the given error level * @@ -169,6 +184,9 @@ class ErrorHandler { if ($errorLevel == E_USER_ERROR) { return '[ManiaControl ERROR]'; } + if ($errorLevel == self::MC_DEBUG_NOTICE) { + return '[ManiaControl DEBUG]'; + } return "[PHP {$errorLevel}]"; } } \ No newline at end of file