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

@ -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;
}
}