当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::write方法代码示例

本文整理汇总了PHP中Cake\Log\Log::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::write方法的具体用法?PHP Log::write怎么用?PHP Log::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Log\Log的用法示例。


在下文中一共展示了Log::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:dehare,项目名称:cake-tracelog,代码行数:7,代码来源:TraceLog.php

示例2: 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']);
 }
开发者ID:kikituki,项目名称:cakephp3,代码行数:36,代码来源:LoginController.php

示例3: 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;
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:13,代码来源:StudentTTable.php

示例4: testSummary

 /**
  * Test that the log panel outputs a summary.
  *
  * @return void
  */
 public function testSummary()
 {
     Log::write('error', 'Test');
     $this->assertEquals(1, $this->panel->summary());
     Log::write('error', 'Test 2');
     Log::write('notice', 'A thing');
     $this->assertEquals(3, $this->panel->summary());
 }
开发者ID:meotimdihia,项目名称:cakephp-test-elasticsearch,代码行数:13,代码来源:LogPanelTest.php

示例5: toArray

 /**
  * 	
  * @return array Um array com os dados da resposta.
  */
 public function toArray()
 {
     if (is_null($this->_response->json)) {
         Log::write('debug', print_r($this->_response->body));
         return ['success' => false, 'message' => 'Erro na resposta recebida do servidor.'];
     }
     return $this->_response->json;
 }
开发者ID:mswagencia,项目名称:msw-appcore,代码行数:12,代码来源:ApiResponse.php

示例6: main

 public function main()
 {
     $XTime = time() - 60 * 24 * 3600;
     $conditions = array('Notifications.created <' => date('Y-m-d H:i:s', $XTime));
     if (!$this->Notifications->deleteAll($conditions)) {
         Log::write('error', 'FAILED: Deleting older Notifications!!', 'cron_jobs');
     }
 }
开发者ID:ujjwalwahi,项目名称:error-reporting-server,代码行数:8,代码来源:CleanOldNotifsShell.php

示例7: initialize

 public function initialize()
 {
     $loginUser = $this->request->session()->read('loginUser');
     Log::write('debug', 'article:' . $loginUser);
     if (empty($loginUser)) {
         Log::write('debug', '未ログインエラー');
         return $this->redirect(['action' => '../Error/index']);
     }
 }
开发者ID:kikituki,项目名称:cakephp3,代码行数:9,代码来源:UsersController.php

示例8: search

 public function search()
 {
     if ($this->request->is('ajax')) {
         Log::write('debug', 'Dies ist ein Test');
         $isbn = $this->request->query['value'];
         echo json_encode(Dnb::dnb($isbn));
         die;
     }
 }
开发者ID:matthiasmoritz,项目名称:exlibris-openlibrary,代码行数:9,代码来源:HarvesterController.php

示例9: testLogging

 /**
  * testLogging
  *
  * @return void
  */
 public function testLogging()
 {
     Log::config('dblogtest', ['className' => 'Burzum\\DatabaseLog\\Log\\Engine\\DatabaseLog', 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency']]);
     Log::write('warning', 'testing');
     $result = $this->Logs->find()->first();
     $this->assertEquals($result->level, 'warning');
     $this->assertEquals($result->message, 'testing');
     $this->Logs->deleteAll([]);
 }
开发者ID:burzum,项目名称:cakephp-database-log,代码行数:14,代码来源:DatabaseLogTest.php

示例10: afterRules

 public function afterRules(Cake\Event\Event $event, Cat $entity, \ArrayObject $options, $result, $operation)
 {
     Log::write("debug", "afterRules");
     Log::write("debug", $event->name());
     Log::write("debug", "entity " . $entity);
     Log::write("debug", $options);
     Log::write("debug", "result " . $result);
     Log::write("debug", "operation " . $operation);
 }
开发者ID:jeffblack360,项目名称:cakeblog,代码行数:9,代码来源:CatsTable.php

示例11: send

 public function send(Email $email)
 {
     $headers = $email->getHeaders(['from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc']);
     $to = $headers['To'];
     $subject = str_replace(["\r", "\n"], '', $email->subject());
     $to = str_replace(["\r", "\n"], '', $to);
     $message = implode('\\n', $email->message());
     Log::write('debug', 'Mail: to(' . $to . ') subject(' . $subject . ') message(' . $message . ')');
     return ['headers' => $headers, 'message' => $message];
 }
开发者ID:edasubert,项目名称:tweeslate,代码行数:10,代码来源:DebugTransport.php

示例12: testReset

 /**
  * @return void
  */
 public function testReset()
 {
     $this->Logs = TableRegistry::get('DatabaseLog.DatabaseLogs');
     Log::write('info', 'six');
     $count = $this->Logs->find()->count();
     $this->assertTrue($count > 0);
     $this->Shell->runCommand(['reset', '-q']);
     $count = $this->Logs->find()->count();
     $this->assertSame(0, $count);
 }
开发者ID:dereuromark,项目名称:cakephp-databaselog,代码行数:13,代码来源:DatabaseLogShellTest.php

示例13: testLogWriting

 /**
  * Tests the log write method
  *
  * @return void
  */
 public function testLogWriting()
 {
     $View = new View();
     $countBefore = $this->Logs->find()->count();
     $View->log('x');
     $View->log('warning', LOG_WARNING);
     Log::write(LOG_ERR, 'y');
     Log::write(LOG_INFO, 'z');
     $countAfter = $this->Logs->find()->count();
     $this->assertSame($countBefore + 8, $countAfter);
     // should be 4 (but for some reason everything is added twice
 }
开发者ID:dereuromark,项目名称:cakephp-databaselog,代码行数:17,代码来源:DatabaseLogTest.php

示例14: _logException

 /**
  * Handles exception logging
  *
  * @param \Exception $exception Exception instance.
  * @return bool
  */
 protected function _logException(\Exception $exception)
 {
     $blacklist = ['Cake\\Routing\\Exception\\MissingControllerException', 'Cake\\Routing\\Exception\\MissingActionException', 'Cake\\Routing\\Exception\\PrivateActionException', 'Cake\\Routing\\Exception\\NotFoundException'];
     if (isset($this->_options['log404'])) {
         $blacklist = $this->_options['log404'];
     }
     if ($blacklist && in_array(get_class($exception), (array) $blacklist)) {
         $level = LOG_ERR;
         Log::write($level, $this->_getMessage($exception), ['404']);
         return;
     }
     return parent::_logException($exception);
 }
开发者ID:olmprakash,项目名称:cakephp-tools,代码行数:19,代码来源:ErrorHandler.php

示例15: _logException

 /**
  * Handles exception logging
  *
  * @param \Exception $exception Exception instance.
  * @return bool
  */
 protected function _logException(Exception $exception)
 {
     $blacklist = ['Cake\\Routing\\Exception\\MissingControllerException', 'Cake\\Routing\\Exception\\MissingActionException', 'Cake\\Routing\\Exception\\PrivateActionException', 'Cake\\Routing\\Exception\\NotFoundException', 'Cake\\Datasource\\Exception\\RecordNotFoundException', 'Cake\\Network\\Exception\\MethodNotAllowedException', 'Cake\\Network\\Exception\\BadRequestException', 'Cake\\Network\\Exception\\ForbiddenException', 'Cake\\Network\\Exception\\GoneException', 'Cake\\Network\\Exception\\ConflictException', 'Cake\\Network\\Exception\\InvalidCsrfToken', 'Cake\\Network\\Exception\\UnauthorizedException', 'Cake\\Network\\Exception\\NotAcceptableException'];
     if (isset($this->_options['log404'])) {
         $blacklist = $this->_options['log404'];
     }
     if ($blacklist && in_array(get_class($exception), (array) $blacklist)) {
         $level = LOG_ERR;
         Log::write($level, $this->_getMessage($exception), ['404']);
         return false;
     }
     return parent::_logException($exception);
 }
开发者ID:dereuromark,项目名称:cakephp-tools,代码行数:19,代码来源:ErrorHandler.php


注:本文中的Cake\Log\Log::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。