trigger debug notice possability

This commit is contained in:
kremsy 2014-02-17 12:54:31 +01:00 committed by Steffen Schröder
parent 8fa4abfb7d
commit dbbb0c2f13

View File

@ -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}]";
}
}