public function log() { $log = KLogger::instance(KLOGGER_PATH . "processors/", KLogger::DEBUG); $log->logInfo("userxplog > log > start userId : " . $this->userId . " xp : " . $this->xp . " type : " . $this->type . " time : " . $this->time . " gameId : " . $this->gameId . " result : " . $this->result . " opponentId : " . $this->opponentId); if (!empty($this->userId)) { $userXPLog = new GameUserXpLog(); $userXPLog->setUserId($this->userId); $userXPLog->setXp($this->xp); $userXPLog->setTime($this->time); $userXPLog->setType($this->type); $userXPLog->setGameId($this->gameId); $userXPLog->setResult($this->result); $userXPLog->setOpponentId($this->opponentId); try { $user = GameUsers::getGameUserById($this->userId); if (!empty($user)) { $userXPLog->setUserLevel($user->userLevelNumber); $userXPLog->setUserCoin($user->coins); //$userCoinLog->setUserSpentCoin($user->opponentId); } } catch (Exception $exc) { $log->logError("userxplog > log > User Error : " . $exc->getTraceAsString()); } try { $userXPLog->insertIntoDatabase(DBUtils::getConnection()); $log->logInfo("userxplog > log > Success"); } catch (Exception $exc) { $log->logError("userxplog > log > Error : " . $exc->getTraceAsString()); } } else { $log->logError("userxplog > log > user Id is empty "); } }