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

@ -196,10 +196,10 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) {
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) {
$this->maniaControl->log("Try to connect on Dedimania");
Logger::log("Try to connect on Dedimania");
if (!$data || $error) {
$this->maniaControl->log("Dedimania Error: '{$error}'");
Logger::logError("Dedimania Error: '{$error}'");
}
$data = $this->decode($data);
@ -216,11 +216,11 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$responseData = $methodResponse[0];
$this->dedimaniaData->sessionId = $responseData['SessionId'];
if ($this->dedimaniaData->sessionId) {
$this->maniaControl->log("Dedimania connection successfully established.");
Logger::log("Dedimania connection successfully established.");
$this->fetchDedimaniaRecords();
$this->init = true;
} else {
$this->maniaControl->log("Error while opening Dedimania Connection");
Logger::logError("Error while opening Dedimania Connection");
}
if (self::DEDIMANIA_DEBUG) {
@ -296,7 +296,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
//$this->maniaControl->fileReader->postDataTest($this->request,self::DEDIMANIA_URL, function ($data, $error) {
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$this->maniaControl->log('Dedimania Error: ' . $error);
Logger::logError('Dedimania Error: ' . $error);
}
$data = $this->decode($data);
@ -572,7 +572,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) {
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$this->maniaControl->log("Dedimania Error: " . $error);
Logger::logError("Dedimania Error: " . $error);
}
$data = $this->decode($data);
@ -616,7 +616,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$player) {
if ($error) {
$this->maniaControl->log("Dedimania Error: " . $error);
Logger::logError("Dedimania Error: " . $error);
}
$data = $this->decode($data);
@ -663,7 +663,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$this->maniaControl->log("Dedimania Error: " . $error);
Logger::logError("Dedimania Error: " . $error);
}
$data = $this->decode($data);
@ -733,7 +733,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$this->maniaControl->log("Dedimania Error: " . $error);
Logger::logError("Dedimania Error: " . $error);
}
if (self::DEDIMANIA_DEBUG) {
@ -783,7 +783,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$this->maniaControl->log("Dedimania Error: " . $error);
Logger::logError("Dedimania Error: " . $error);
}
$data = $this->decode($data);

View File

@ -12,6 +12,7 @@ use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Files\AsynchronousFileReader;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map;
use ManiaControl\Players\Player;
@ -265,7 +266,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$this->mxKarma['session'] = $data->data;
$this->activateSession($mxKarmaCode);
} else {
$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma");
Logger::logError("Error while authenticating on Mania-Exchange Karma");
// TODO remove temp trigger
$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message);
$this->mxKarma['connectionInProgress'] = false;
@ -297,7 +298,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return;
}
if ($data->success && $data->data->activated) {
$this->maniaControl->log('Successfully authenticated on Mania-Exchange Karma');
Logger::log('Successfully authenticated on Mania-Exchange Karma');
// Fetch the Mx Karma Votes
$this->getMxKarmaVotes();
@ -308,7 +309,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
} else {
$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message, $query);
}
$this->maniaControl->log("Error while activating Mania-Exchange Karma Session: " . $data->data->message);
Logger::logError("Error while activating Mania-Exchange Karma Session: " . $data->data->message);
unset($this->mxKarma['session']);
}
}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000);
@ -397,10 +398,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$this->updateManialink = true;
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_KARMA_MXUPDATED, $this->mxKarma);
$this->maniaControl->log('MX-Karma Votes successfully fetched!');
Logger::logInfo('MX-Karma Votes successfully fetched!');
} else {
// Problem occurred
$this->maniaControl->log('Error while fetching votes: ' . $data->data->message);
Logger::logError('Error while fetching votes: ' . $data->data->message);
if ($data->data->message === 'invalid session') {
unset($this->mxKarma['session']);
} else {
@ -496,10 +497,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return;
}
if ($data->success) {
$this->maniaControl->log('Votes successfully submitted!');
Logger::logInfo('Votes successfully submitted!');
} else {
// Problem occurred
$this->maniaControl->log("Error while updating votes: '{$data->data->message}'");
Logger::logError("Error while updating votes: '{$data->data->message}'");
if ($data->data->message === "invalid session") {
unset($this->mxKarma['session']);
} else {