improved error logging

This commit is contained in:
Steffen Schröder
2014-05-15 13:04:05 +02:00
parent 9a84a983d3
commit a6635f15c5
3 changed files with 25 additions and 25 deletions

View File

@ -156,13 +156,29 @@ class ManiaControl implements CommandListener, TimerListener {
$configFileName = ($configId ? $configId : 'server.xml');
$this->config = FileUtil::loadConfig($configFileName);
if (!$this->config) {
trigger_error("Error loading Configuration XML-File! ('{$configFileName}')", E_USER_ERROR);
$this->quit("Error loading Configuration XML-File! ('{$configFileName}')", true);
}
if (!$this->config->server->port || $this->config->server->port == 'port') {
trigger_error("Your Configuration File ('{$configFileName}') doesn't seem to be maintained. Please check it again!", E_USER_ERROR);
$this->quit("Your Configuration File ('{$configFileName}') doesn't seem to be maintained. Please check it again!", true);
}
}
/**
* Quit ManiaControl and log the given message
*
* @param string $message
* @param bool $errorPrefix
*/
public function quit($message = null, $errorPrefix = false) {
if ($message) {
if ($errorPrefix) {
$message = '[ERROR] ' . $message;
}
$this->log($message);
}
exit();
}
/**
* Check Connection
*/
@ -265,22 +281,6 @@ class ManiaControl implements CommandListener, TimerListener {
$this->quit("ManiaControl Shutdown requested by '{$player->login}'!");
}
/**
* Quit ManiaControl and log the given message
*
* @param string $message
* @param bool $errorPrefix
*/
public function quit($message = null, $errorPrefix = false) {
if ($message) {
if ($errorPrefix) {
$message = '[ERROR] ' . $message;
}
$this->log($message);
}
exit();
}
/**
* Handle PHP Process Shutdown
*/