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