debug mode constant
option to log even suppressed errors
This commit is contained in:
parent
4194f99c2a
commit
0a716aeb91
@ -19,12 +19,12 @@ class ErrorHandler {
|
|||||||
*/
|
*/
|
||||||
const MC_DEBUG_NOTICE = 'ManiaControl.DebugNotice';
|
const MC_DEBUG_NOTICE = 'ManiaControl.DebugNotice';
|
||||||
const SETTING_RESTART_ON_EXCEPTION = 'Automatically restart on Exceptions';
|
const SETTING_RESTART_ON_EXCEPTION = 'Automatically restart on Exceptions';
|
||||||
|
const LOG_SUPPRESSED_ERRORS = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
private $reportErrors = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct Error Handler
|
* Construct Error Handler
|
||||||
@ -58,7 +58,7 @@ class ErrorHandler {
|
|||||||
$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString;
|
$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString;
|
||||||
$this->maniaControl->log($logMessage);
|
$this->maniaControl->log($logMessage);
|
||||||
|
|
||||||
if ($this->reportErrors) {
|
if (!ManiaControl::DEBUG_MODE) {
|
||||||
$error = array();
|
$error = array();
|
||||||
$error['Type'] = 'Exception';
|
$error['Type'] = 'Exception';
|
||||||
$error['Message'] = $message;
|
$error['Message'] = $message;
|
||||||
@ -201,7 +201,8 @@ class ErrorHandler {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handleError($errorNumber, $errorString, $errorFile = null, $errorLine = -1, array $errorContext = array()) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +216,7 @@ class ErrorHandler {
|
|||||||
$logMessage = $message . PHP_EOL . 'File&Line: ' . $fileLine . PHP_EOL . 'Trace: ' . $traceString;
|
$logMessage = $message . PHP_EOL . 'File&Line: ' . $fileLine . PHP_EOL . 'Trace: ' . $traceString;
|
||||||
$this->maniaControl->log($logMessage);
|
$this->maniaControl->log($logMessage);
|
||||||
|
|
||||||
if ($this->reportErrors && !$this->isUserErrorNumber($errorNumber)) {
|
if (!ManiaControl::DEBUG_MODE && !$this->isUserErrorNumber($errorNumber) && !$suppressed) {
|
||||||
$error = array();
|
$error = array();
|
||||||
$error['Type'] = 'Error';
|
$error['Type'] = 'Error';
|
||||||
$error['Message'] = $message;
|
$error['Message'] = $message;
|
||||||
|
@ -52,6 +52,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
|||||||
const OS_UNIX = 'Unix';
|
const OS_UNIX = 'Unix';
|
||||||
const OS_WIN = 'Windows';
|
const OS_WIN = 'Windows';
|
||||||
const SCRIPT_TIMEOUT = 10;
|
const SCRIPT_TIMEOUT = 10;
|
||||||
|
const DEBUG_MODE = false;
|
||||||
const URL_WEBSERVICE = 'http://ws.maniacontrol.com/';
|
const URL_WEBSERVICE = 'http://ws.maniacontrol.com/';
|
||||||
const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl';
|
const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl';
|
||||||
const SETTING_PERMISSION_RESTART = 'Restart ManiaControl';
|
const SETTING_PERMISSION_RESTART = 'Restart ManiaControl';
|
||||||
|
@ -39,7 +39,6 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
* @see \ManiaControl\Plugins\Plugin::prepare()
|
* @see \ManiaControl\Plugins\Plugin::prepare()
|
||||||
*/
|
*/
|
||||||
public static function prepare(ManiaControl $maniaControl) {
|
public static function prepare(ManiaControl $maniaControl) {
|
||||||
// do nothing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user