trigger debug notice possability
This commit is contained in:
		
				
					committed by
					
						
						Steffen Schröder
					
				
			
			
				
	
			
			
			
						parent
						
							8fa4abfb7d
						
					
				
				
					commit
					dbbb0c2f13
				
			@@ -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}]";
 | 
			
		||||
	}
 | 
			
		||||
} 
 | 
			
		||||
		Reference in New Issue
	
	Block a user