本文整理汇总了PHP中Cake\Log\Log::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::error方法的具体用法?PHP Log::error怎么用?PHP Log::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Log\Log
的用法示例。
在下文中一共展示了Log::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
public function error()
{
$this->autoRender = false;
$url = $this->request->url;
\Cake\Log\Log::error('User hit with unknown api Endpoint : ' . $url);
$this->response->body(DTO\ErrorDto::prepareError(404));
}
示例2: index
public function index()
{
$this->autoRender = false;
$userId = $this->request->query("userId");
$restaurantId = $this->request->query("restaurantId");
\Cake\Log\Log::debug("Download request come with userId :- " . $userId . ' restaurantId :- ' . $restaurantId);
if (empty($userId) or empty($restaurantId)) {
$this->response->body(DTO\ErrorDto::prepareError(101));
\Cake\Log\Log::error("userId or restaurantID is blank ");
return;
}
$restaurantController = new RestaurantController();
if (!$restaurantController->isValidate($restaurantId)) {
$this->response->body(DTO\ErrorDto::prepareError(100));
\Cake\Log\Log::error("request with incorrect restaurantId :- " . $restaurantId);
return;
}
$userController = new UserController();
if (!$userController->isUserValid($userId, $restaurantId)) {
$this->response->body(DTO\ErrorDto::prepareError(102));
\Cake\Log\Log::error("request with incorrect userId :- " . $userId);
return;
}
\Cake\Log\Log::debug('Download request is validate successfully ');
$syncController = new SyncController();
$syncController->download($userId, $restaurantId);
}
示例3: takeawayInsert
public function takeawayInsert(UploadDTO\TakeawayUploadDto $takeawayRequest, $restaurantId)
{
try {
$tableObj = $this->connect();
$newEntity = $tableObj->newEntity();
$newEntity->TakeawayId = $takeawayRequest->takeawayId;
$newEntity->TakeawayNo = $takeawayRequest->takeawayNo;
$newEntity->Discount = $takeawayRequest->discount;
$newEntity->DeliveryCharges = $takeawayRequest->deliveryCharges;
$newEntity->CustId = $takeawayRequest->custId;
$newEntity->RestaurantId = $restaurantId;
$newEntity->UserId = $takeawayRequest->userId;
$newEntity->SourceId = $takeawayRequest->sourceId;
$newEntity->CreatedDate = date(VB_DATE_TIME_FORMAT);
$newEntity->UpdatedDate = date(VB_DATE_TIME_FORMAT);
if ($tableObj->save($newEntity)) {
Log::debug('Takeaway entry stored for custId :- ' . $takeawayRequest->custId);
return $takeawayRequest->takeawayNo;
}
Log::error('Takeaway entry stored for custId :- ' . $takeawayRequest->custId);
return FALSE;
} catch (Exception $ex) {
return FALSE;
}
}
示例4: saveNetworkDeviceInfo
public function saveNetworkDeviceInfo(DTO\ClsNetworkDeviceInfoDto $infoDto)
{
if ($infoDto and !$this->isPresent($infoDto->userId)) {
$entity = $this->connect()->newEntity();
$entity->UserId = $infoDto->userId;
$entity->Board = $infoDto->board;
$entity->Brand = $infoDto->brand;
$entity->Manufacturer = $infoDto->manufacturer;
$entity->Model = $infoDto->model;
$entity->Product = $infoDto->product;
$entity->FmVersion = $infoDto->fmVersion;
$entity->IpAddress = $infoDto->ip;
$entity->City = $infoDto->city;
$entity->Region = $infoDto->region;
$entity->Country = $infoDto->country;
if ($this->connect()->save($entity)) {
\Cake\Log\Log::debug("User Network Device Info save in database for userid : " . $infoDto->userId);
return SUCCESS;
}
\Cake\Log\Log::error("User Network Device Info not save in database for userid : " . $infoDto->userId);
return FAIL;
}
\Cake\Log\Log::error(" userid : " . $infoDto->userId . " record exist in database");
return FAIL;
}
示例5: index
public function index()
{
$this->autoRender = false;
$restaurantId = $this->request->query('restaurantId');
$imei = $this->request->query('imei');
$macAddress = $this->isNull($this->request->query('macId'));
$info = base64_decode($this->request->query('info'));
$ipAddress = $this->request->clientIp();
$restaurantIMEIController = new RestaurantImeiController();
if (!$restaurantIMEIController->isPresent($restaurantId, $imei, $macAddress)) {
$this->response->body(DTO\ErrorDto::prepareError(116));
\Cake\Log\Log::error("request with incorrect restaurantId :- " . $restaurantId);
return;
}
$restaurantController = new RestaurantController();
\Cake\Log\Log::info('Request is in Download Controller');
if ($restaurantController->isValidate($restaurantId) and !empty($info)) {
$networkDeviceDto = UploadDTO\NetworkDeviceInfoDto::Deserialize($info);
$ipInfo = new Component\Ipinfo();
$ipDetails = $ipInfo->getFullIpDetails($imei, $networkDeviceDto, $ipAddress);
$networkDeviceController = new NetworkDeviceController();
$addNetworkDeviceInfo = $networkDeviceController->addNetworkDeviceInfo($ipDetails, $restaurantId, $macAddress);
$sqliteController = new SqliteController();
$sqliteController->getDB($restaurantId);
} else {
$this->response->body(DTO\ErrorDto::prepareError(100));
}
}
示例6: googleRecaptcha
/**
* Validate a google recaptcha.
*
* @param string $value The captcha value.
* @param array $context The form context.
* @return bool
*/
public static function googleRecaptcha($value, $context)
{
$httpClient = new Client();
$googleReponse = $httpClient->post('https://www.google.com/recaptcha/api/siteverify', ['secret' => Configure::read('Google.Recaptcha.secret'), 'response' => $value, 'remoteip' => Router::getRequest()->clientIp()]);
$result = json_decode($googleReponse->body(), true);
if (!empty($result['error-codes'])) {
Log::error('Google Recaptcha: ' . $result['error-codes'][0]);
}
return (bool) $result['success'];
}
示例7: makeSyncEntry
private function makeSyncEntry(UploadDTO\BillEntryDto $billEntryDto)
{
$newBillEntry = $this->getTableObj()->getNewBill($billEntryDto->billNo, $billEntryDto->restaurantId, $billEntryDto->userId);
if (!is_null($newBillEntry)) {
$syncController = new SyncController();
$syncResult = $syncController->billEntry($billEntryDto->userId, json_encode($newBillEntry), $this->insert, $billEntryDto->restaurantId);
Log::debug(' New bill entry successfully place in sync table');
return $syncResult;
}
Log::error('Error occured in sync entry of new bill');
return;
}
示例8: toPHP
/**
* Casts given value from a database type to PHP equivalent
*
* @param mixed $value value to be converted to PHP equivalent
* @param Driver $driver object from which database preferences and configuration will be extracted
* @return mixed
*/
public function toPHP($value, Driver $driver)
{
if (!is_string($value) || $value === null) {
return null;
}
$unserialized = unserialize($value);
if ($unserialized === false) {
Log::error(__('Could not unserialize payload:'));
Log::error($value);
$unserialized = [];
}
return $unserialized;
}
示例9: up
public function up()
{
$this->autoRender = false;
// $json = null;
$json = $this->request->input();
\Cake\Log\Log::debug("Upload request input json : " . $json);
\Cake\Log\Log::debug("Checking is request empty or not");
if (empty($json)) {
$this->response->body(DTO\ClsErrorDto::prepareError(104));
\Cake\Log\Log::error("User requested with invalid data");
return;
}
$arr = DTO\ClsUploadDeserializerDto::Deserialize($json);
if (empty($arr->user) or empty($arr->data)) {
// $this->response->body(DTO\ClsErrorDto::prepareError(117));
return;
}
$user = DTO\ClsUserDto::Deserialize($arr->user);
if ($this->userValidation($user->userId, $user->emailId, $user->userName)) {
$senderUserId = $user->userId;
foreach ($arr->data as $index => $record) {
\Cake\Log\Log::info('Index : ' . $index . 'Record :' . $record->tableName);
switch ($record->tableName) {
case $this->table['TC']:
\Cake\Log\Log::info("Comment section");
$commentDto = DTO\ClsCommentAndLikeDto::Deserialize($record->tableData);
$this->uploadComment($senderUserId, $commentDto);
break;
case $this->table['TL']:
$likeDto = DTO\ClsCommentAndLikeDto::Deserialize($record->tableData);
$this->uploadLike($user->userId, $likeDto);
break;
case $this->table['TA']:
$answerDto = DTO\ClsAnswerDto::Deserialize($record->tableData);
\Cake\Log\Log::debug("Accepted Answer data");
$this->uploadAnswer($user->userId, $answerDto);
break;
// case $this->table['TU']:
// $userDto = DTO\ClsUserDto::Deserialize($record->tableData);
// $this->uploadUser($user->userId,$userDto);
// break;
// case $this->table['TI']:
// $imageDto = DTO\ClsImagesDto::Deserialize($record->tableData);
// $this->image($imageDto);
// break;
}
}
} else {
$this->response->body(DTO\ClsErrorDto::prepareError(100));
}
}
示例10: Insert
public function Insert($userId, $update, $table, $operation)
{
try {
$query = $this->connect()->newEntity();
$query->UserId = $userId;
$query->JsonSync = $update;
$query->TableName = $table;
$query->Operation = $operation;
$query->UpdatedDate = date("Y-m-d H:i:s");
$this->connect()->save($query);
} catch (Excetion $e) {
\Cake\Log\Log::error("Database exception : " . $ex);
}
}
示例11: authenticate
/**
* Authentication hook to authenticate a user against an LDAP server.
*
* @param \Cake\Network\Request $request The request that contains login information.
* @param \Cake\Network\Response $response Unused response object.
* @return mixed False on login failure. An array of User data on success.
*/
public function authenticate(Request $request, Response $response)
{
// This will probably be cn or an email field to search for
Log::debug("[Yalp.authenticate] Authentication started", 'yalp');
$userField = $this->form_fields['username'];
$passField = $this->form_fields['password'];
$userModel = $this->config('userModel');
list($plugin, $model) = pluginSplit($userModel);
// Definitely not authenticated if we haven't got the request data...
if (!isset($request->data[$userModel])) {
Log::error("[Yalp.authenticate] No request data, cannot authenticate", 'yalp');
return false;
}
// We need to know the username, or email, or some other unique ID
$submittedDetails = $request->data[$userModel];
if (!isset($submittedDetails[$userField])) {
//Log::write('yalp', "[Yalp.authenticate] No username supplied, cannot authenticate");
return false;
}
// Make sure it's a valid string...
$username = $submittedDetails[$userField];
if (!is_string($username)) {
Log::error("[Yalp.authenticate] Invalid username, cannot authenticate", 'yalp');
return false;
}
// Make sure they gave us a password too...
$password = $submittedDetails[$passField];
if (!is_string($password) || empty($password)) {
Log::error("[Yalp.authenticate] Invalid password, cannot authenticate", 'yalp');
return false;
}
// Check whether or not user exists on LDAP
if (!$this->Yalp->validateUser($username, $password)) {
Log::error("[Yalp.authenticate] User '{$username}' could not be found on LDAP", 'yalp');
return false;
} else {
Log::debug("[Yalp.authenticate] User '{$username}' was found on LDAP", 'yalp');
}
// Check on DB
$comparison = 'LOWER(' . $model . '.' . $userField . ')';
$conditions = array($comparison => strtolower($username));
$dbUser = TableRegistry::get($userModel)->find('all', array('conditions' => $conditions, 'recursive' => false))->first();
// If we couldn't find them in the database, warn and fail
if (empty($dbUser)) {
Log::warning("[Yalp.authenticate] Could not find a database entry for {$username}", 'yalp');
return false;
}
// ...and return the user object.
return $dbUser->toArray();
}
示例12: occupy
public function occupy($tableId, $isOccupied)
{
if ($tableId) {
$conditions = ['TableId =' => $tableId];
$updateTable = $this->connect()->query()->update();
$updateTable->set(['IsOccupied' => $isOccupied]);
$updateTable->where($conditions);
if ($updateTable->execute()) {
Log::debug('Table Occupied status changes for giveen request');
return true;
}
Log::error('Table Occupied status changes for giveen request');
return false;
}
}
示例13: deleteCustomer
public function deleteCustomer(UploadDTO\CustomerUploadDto $customerInfo, $userInfo)
{
$conditions = ['CustId =' => $customerInfo->custId, 'RestaurantId =' => $userInfo->restaurantId];
try {
$delete = $this->connect()->deleteAll($conditions);
if ($delete) {
Log::debug('Waiting Customer' . $customerInfo->custName . ' deleted from customer table');
return true;
}
Log::error('Error Occured in customer table during customer deletion');
return false;
} catch (Exception $ex) {
return false;
}
}
示例14: excutePreparedStatement
public function excutePreparedStatement($Text)
{
$db = new \SQLite3($this->sqliteFile);
if ($Text) {
try {
$success = $db->exec($Text);
$db->close();
return $success;
} catch (Exception $ex) {
throw "sqlite database error";
}
}
\Cake\Log\Log::error('Table insert script is not valid');
return false;
}
示例15: updateUserInfo
private function updateUserInfo($userDto)
{
if (is_null($userDto->userId) or is_null($userDto->emailId) or is_null($userDto->userName)) {
$this->response->body(DTO\ClsErrorDto::prepareError(114));
\Cake\Log\Log::error("User information is empty");
return FAIL;
}
if ($this->getTableObj()->update($userDto)) {
$this->response->body(DTO\ClsErrorDto::prepareSuccessMessage("User updated successfully for userid " . $userDto->userId));
$syncController = new SyncController();
$downloadUserDto = new DownloadDto\UserDto($userDto->userId, $userDto->userName, $userDto->photoUrl);
$syncController->userEntry($userDto->userId, json_encode($downloadUserDto), INSERT);
} else {
$this->response->body(DTO\ClsErrorDto::prepareError(108));
}
}