debug mode constant

option to log even suppressed errors
This commit is contained in:
Steffen Schröder 2014-05-18 21:17:30 +02:00
parent 4194f99c2a
commit 0a716aeb91
3 changed files with 6 additions and 5 deletions

View File

@ -19,12 +19,12 @@ class ErrorHandler {
*/
const MC_DEBUG_NOTICE = 'ManiaControl.DebugNotice';
const SETTING_RESTART_ON_EXCEPTION = 'Automatically restart on Exceptions';
const LOG_SUPPRESSED_ERRORS = false;
/*
* Private Properties
*/
private $maniaControl = null;
private $reportErrors = true;
/**
* Construct Error Handler
@ -58,7 +58,7 @@ class ErrorHandler {
$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString;
$this->maniaControl->log($logMessage);
if ($this->reportErrors) {
if (!ManiaControl::DEBUG_MODE) {
$error = array();
$error['Type'] = 'Exception';
$error['Message'] = $message;
@ -201,7 +201,8 @@ class ErrorHandler {
* @return bool
*/
public function handleError($errorNumber, $errorString, $errorFile = null, $errorLine = -1, array $errorContext = array()) {
if (error_reporting() === 0) {
$suppressed = (error_reporting() === 0);
if ($suppressed && !self::LOG_SUPPRESSED_ERRORS) {
return false;
}
@ -215,7 +216,7 @@ class ErrorHandler {
$logMessage = $message . PHP_EOL . 'File&Line: ' . $fileLine . PHP_EOL . 'Trace: ' . $traceString;
$this->maniaControl->log($logMessage);
if ($this->reportErrors && !$this->isUserErrorNumber($errorNumber)) {
if (!ManiaControl::DEBUG_MODE && !$this->isUserErrorNumber($errorNumber) && !$suppressed) {
$error = array();
$error['Type'] = 'Error';
$error['Message'] = $message;

View File

@ -52,6 +52,7 @@ class ManiaControl implements CommandListener, TimerListener {
const OS_UNIX = 'Unix';
const OS_WIN = 'Windows';
const SCRIPT_TIMEOUT = 10;
const DEBUG_MODE = false;
const URL_WEBSERVICE = 'http://ws.maniacontrol.com/';
const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl';
const SETTING_PERMISSION_RESTART = 'Restart ManiaControl';

View File

@ -39,7 +39,6 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
* @see \ManiaControl\Plugins\Plugin::prepare()
*/
public static function prepare(ManiaControl $maniaControl) {
// do nothing
}
/**