replaced ManiaControl log method by direct Logger usage

This commit is contained in:
Steffen Schröder
2014-08-05 01:49:13 +02:00
parent b62d6af929
commit a6b0d749bc
22 changed files with 111 additions and 95 deletions

View File

@ -10,6 +10,7 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Commands\CommandListener;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
@ -259,7 +260,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
* @param string $login
*/
private function shutdownServer($login = '-') {
$this->maniaControl->log("Server shutdown requested by '{$login}'!");
Logger::logInfo("Server shutdown requested by '{$login}'!");
$this->maniaControl->getClient()->stopServer();
}

View File

@ -2,6 +2,7 @@
namespace ManiaControl\Server;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
/**
@ -48,7 +49,7 @@ class ScriptManager {
$actionName = ($enable ? 'en' : 'dis');
$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings);
$this->maniaControl->log("Script Callbacks successfully {$actionName}abled!");
Logger::logInfo("Script Callbacks successfully {$actionName}abled!");
return true;
}

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use ManiaControl\Utils\CommandLineHelper;
@ -399,18 +400,18 @@ class Server implements CallbackListener {
$waitBegin = time();
$maxWaitTime = 50;
$lastStatus = $response->name;
$this->maniaControl->log("Waiting for server to reach status {$statusCode}...");
$this->maniaControl->log("Current Status: {$lastStatus}");
Logger::log("Waiting for server to reach status {$statusCode}...");
Logger::log("Current Status: {$lastStatus}");
while ($response->code !== 4) {
sleep(1);
$response = $this->maniaControl->getClient()->getStatus();
if ($lastStatus !== $response->name) {
$this->maniaControl->log("New Status: {$response->name}");
Logger::log("New Status: {$response->name}");
$lastStatus = $response->name;
}
if (time() - $maxWaitTime > $waitBegin) {
// It took too long to reach the status
trigger_error("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! ");
Logger::logError("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! ");
return false;
}
}

View File

@ -3,6 +3,7 @@
namespace ManiaControl\Server;
use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -80,7 +81,7 @@ class UsageReporter implements TimerListener {
$this->maniaControl->getFileReader()->loadFile($url, function ($response, $error) {
$response = json_decode($response);
if ($error || !$response) {
$this->maniaControl->log('Error while Sending data: ' . print_r($error, true));
Logger::logError('Error while Sending data: ' . print_r($error, true));
}
});
}