本文整理汇总了PHP中Cake\Log\Log类的典型用法代码示例。如果您正苦于以下问题:PHP Log类的具体用法?PHP Log怎么用?PHP Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* setup, create mocks
*
* @return Mock object
*/
public function setUp()
{
parent::setUp();
$this->stderr = $this->getMock('Cake\\Console\\ConsoleOutput', [], [], '', false);
$this->Error = $this->getMock('Cake\\Console\\ConsoleErrorHandler', ['_stop'], [['stderr' => $this->stderr]]);
Log::drop('stderr');
}
示例2: onControllerInit
public function onControllerInit($event)
{
$controller = $event->subject();
if (isset($controller->request->params['prefix'])) {
$menuFile = $controller->request->params['prefix'] . '_menus';
if ($theme = Configure::read('App.admin.theme')) {
if ($theme != '' && $theme != 'RearEngine' && Plugin::loaded($theme)) {
$controller->viewBuilder()->theme($theme);
}
}
foreach (Plugin::loaded() as $plugin) {
try {
Configure::load($plugin . '.' . $menuFile, 'default', true);
} catch (\Exception $e) {
if (Configure::read('debug')) {
Log::warning('Unable to load app ' . $plugin . '/Config/' . $menuFile . ' config file', ['scope' => 'RearEngine plugin']);
}
}
}
try {
Configure::load($menuFile, 'default', true);
} catch (\Exception $e) {
if (Configure::read('debug')) {
Log::warning('Unable to load App/Config/' . $menuFile . ' config file.', ['scope' => 'RearEngine plugin']);
}
}
}
}
示例3: customerVisitReport
public function customerVisitReport()
{
$this->autoRender = false;
$restaurantId = $this->request->query('id');
\Cake\Log\Log::debug('Ajax request visited with RestaurantId :-' . $restaurantId);
$customerVisitReportData = $this->getTableObj()->getdata($restaurantId);
if (is_null($customerVisitReportData)) {
$this->response->body(0);
return;
}
$intermediate = [];
foreach ($this->objKey as $key => $value) {
$intermediate[$value] = 0;
}
foreach ($customerVisitReportData as $reportData) {
for ($i = 0; $i < count($this->timeSlot); $i++) {
$index = $this->objKey[$i];
$intermediate[$index] = $intermediate[$index] + $reportData->{$index};
}
}
$data[] = null;
$ind = 0;
foreach ($intermediate as $key => $value) {
$data[$ind++] = new DownloadDTO\RushHourReportDto($value, $this->timeSlot[$key], $this->timeSlot[$key]);
}
$chartData = json_encode($data);
$this->response->body($chartData);
}
示例4: main
/**
* Start the shell and interactive console.
*
* @return int|void
*/
public function main()
{
if (!class_exists('Psy\\Shell')) {
$this->err('<error>Unable to load Psy\\Shell.</error>');
$this->err('');
$this->err('Make sure you have installed psysh as a dependency,');
$this->err('and that Psy\\Shell is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require --dev psy/psysh</info>');
$this->err('');
return 1;
}
$this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>");
$this->out('');
Log::drop('debug');
Log::drop('error');
$this->_io->setLoggers(false);
restore_error_handler();
restore_exception_handler();
$psy = new PsyShell();
$psy->run();
return 0;
}
示例5: 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;
}
示例6: 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));
}
}
示例7: main
/**
* Override main() to handle action
* Starts a Queuesadilla worker
*
* @return void
*/
public function main()
{
$logger = Log::engine($this->getLoggerName('stdout'));
$engine = $this->getEngine($logger);
$worker = $this->getWorker($engine, $logger);
$worker->work();
}
示例8: fetchStudentOrganizations
/**
* @author team_syzzygy
* @param Connection $dbConnection
* @param unknown $studentId
* Fetch student organizations based on the studentId provided
*/
public function fetchStudentOrganizations(Connection $dbConnection, $studentId)
{
$studentTable = $this->getStudentReference();
Log::write('debug', "Student Id passed into fetchStudentOrganizations method is " . $studentId);
$temp = $studentTable->find()->where(['Student_ID' => $studentId])->contain(['StudentOrganizationTypeT'])->first();
return $temp;
}
示例9: write
public static function write($type, $message, $params = [], $trace_level = 0, $log_options = [])
{
$trace_level += 1;
$trace = self::traceMessage($trace_level);
$output = call_user_func_array('sprintf', array_merge([$message], $params));
CakeLog::write($type, $trace . ' - ' . $output, $log_options);
}
示例10: testValidKeyName
/**
* test config() with valid key name
*
* @return void
*/
public function testValidKeyName()
{
Log::config('stdout', ['engine' => 'File']);
Queue::config('valid', ['url' => 'mysql://username:password@localhost:80/database']);
$engine = Queue::engine('valid');
$this->assertInstanceOf('josegonzalez\\Queuesadilla\\Engine\\MysqlEngine', $engine);
}
示例11: main
/**
* Start the shell and interactive console.
*
* @return void
*/
public function main()
{
if (!class_exists('Boris\\Boris')) {
$this->err('<error>Unable to load Boris\\Boris.</error>');
$this->err('');
$this->err('Make sure you have installed boris as a dependency,');
$this->err('and that Boris\\Boris is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require d11wtq/boris</info>');
$this->err('');
return 1;
}
if (!function_exists('pcntl_signal')) {
$this->err('<error>No process control functions.</error>');
$this->err('');
$this->err('You are missing the pcntl extension, the interactive console requires this extension.');
return 2;
}
$this->out('You can exit with <info>CTRL-D</info>');
Log::drop('debug');
Log::drop('error');
$this->_io->setLoggers(false);
restore_error_handler();
restore_exception_handler();
$boris = new Boris('app > ');
$boris->start();
}
示例12: 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;
}
}
示例13: ajustabase
public function ajustabase()
{
$Usuario = TableRegistry::get("usuario");
$Categoria = TableRegistry::get("categoria");
$usuarios = $Usuario->find()->where(['usuario.historico' => 0, 'usuario.pendente' => 0, 'usuario.idUsuario is not' => 0]);
$ldap = new LDAP(3);
$res = array();
$res_ldap = array();
$cats = array();
foreach ($usuarios as $usuario) {
$obj = $ldap->getUsers("(uid=*{$usuario->login}*)");
Log::debug($obj);
$usuario->nomeUsuario = $obj[0]["cn"][0];
$usuario->dre = isset($obj[0]["smtdre"][0]) ? $obj[0]["smtdre"][0] : '';
$usuario->logradouro = isset($obj[0]["street"][0]) ? $obj[0]["street"][0] : '';
$usuario->complemento = isset($obj[0]["smtcomplemento"][0]) ? $obj[0]["smtcomplemento"][0] : '';
$usuario->cidade = isset($obj[0]["smtcidade"][0]) ? $obj[0]["smtcidade"][0] : '';
$usuario->bairro = isset($obj[0]["smtbairro"][0]) ? $obj[0]["smtbairro"][0] : '';
$usuario->pais = isset($obj[0]["smtpais"][0]) ? $obj[0]["smtpais"][0] : '';
$usuario->estado = isset($obj[0]["smtuf"][0]) ? $obj[0]["smtuf"][0] : '';
$usuario->codigoPostal = isset($obj[0]["homepostaladdress"][0]) ? $obj[0]["homepostaladdress"][0] : '';
$usuario->rg = isset($obj[0]['smtrg'][0]) ? $obj[0]['smtrg'][0] : '';
$usuario->cpf = isset($obj[0]['smtcpf'][0]) ? $this->formataCpf($obj[0]['smtcpf'][0]) : '';
$usuario->email = isset($obj[0]['mail'][0]) ? $obj[0]['mail'][0] : '';
$usuario->tel_fixo = isset($obj[0]['telephonenumber'][0]) ? $obj[0]['telephonenumber'][0] : '';
$usuario->tel_cel = isset($obj[0]['mobile'][0]) ? $obj[0]['mobile'][0] : '';
$nascimento = isset($obj[0]['smtnascimento'][0]) ? $obj[0]['smtnascimento'][0] : '19000101';
$usuario->data_nascimento = substr($nascimento, 6, 2) . '/' . substr($nascimento, 4, 2) . '/' . substr($nascimento, 0, 4);
$usuario->data_exp = isset($obj[0]['smtdataexpiracao'][0]) ? $obj[0]['smtdataexpiracao'][0] : '';
$usuario->cadastro = isset($obj[0]['smtdatacadastro'][0]) ? $obj[0]['smtdatacadastro'][0] : '';
//$usuario->ativo = (isset($obj[0]['smtbool'][0])) ? ($obj[0]['smtbool'][0] == 'FALSE') ? false : true : '';
$loginResp = str_replace('uid=', '', explode(',', $obj[0]['smtprofresp'][0])[0]);
$id = $Usuario->find()->where(['login' => $loginResp, 'idTipoUsuario' => 2]);
if ($id->count() > 0) {
$usuario->profResponsavel = $id->first()->idUsuario;
}
if (isset($obj[0]['smtgroups'])) {
foreach ($obj[0]['smtgroups'] as $grupo) {
$busca = $Usuario->Projeto->find('all', ['conditions' => ['grupo' => "{$grupo}"]]);
$number = $busca->count();
if ($number > 0) {
$proj = $Usuario->Projeto->find()->where(['grupo' => "{$grupo}"])->first();
$usuario->idProjeto = $proj->idprojeto;
break;
}
}
}
if (isset($obj[0]['smtcategoria'])) {
$cat = $Categoria->find('all')->where(['upper(nomeCategoria)' => strtoupper($obj[0]['smtcategoria'][0])])->first();
$usuario->idCategoria = $cat->idCategoria;
}
array_push($res_ldap, $obj);
array_push($res, $usuario);
array_push($cats, $cat);
$Usuario->save($usuario);
}
$aviso = new Email('gmail');
$aviso->from(['netadmin@smt.ufrj.br' => 'Controle de Usuarios'])->emailFormat('html')->to('suporte.intranetsmt@gmail.com')->subject('JOB Realizado')->send('Job Ajuste Base executado com sucesso.');
$this->set(compact('res', 'res_ldap', 'cats'));
}
示例14: auth
/**
* Auth method
*
* @return void Redirects on successful add, renders view otherwise.
*/
public function auth()
{
//ログイン処理
// パラメータの受取
$name = $this->request->data['userId'];
$pass = $this->request->data['pass'];
//Usersテーブルを検索
$tableUsers = TableRegistry::get('Users');
$queryStr = "select name from users where name='" . $name . "' and password = '" . $pass . "'";
// パスワード入力値 or 1=1;--
//$queryStr = "select name from users where name='" . $name . "' and password = '" . $pass . "' or 1=1";
Log::write('debug', $queryStr);
//SQL発行
$data = $tableUsers->connection()->query($queryStr);
//配列のサイズで判定する
$cnt = sizeof($data);
if ($cnt == 0) {
//レコードなし認証NGとする
Log::write('debug', '認証エラー');
$this->Flash->error('Auth Error: id or password is incorrect');
// ログイン画面に戻る
return $this->redirect(['action' => '../Login/index']);
}
Log::write('debug', '認証OK');
foreach ($data as $key => $value) {
Log::write('debug', 'userName is :' . $value['name']);
$this->request->session()->write('loginUser', $value['name']);
}
// 成功した場合は記事一覧へ
return $this->redirect(['action' => '../Articles/index']);
}
示例15: 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);
}