當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Database::getLog方法代碼示例

本文整理匯總了PHP中Drupal\Core\Database\Database::getLog方法的典型用法代碼示例。如果您正苦於以下問題:PHP Database::getLog方法的具體用法?PHP Database::getLog怎麽用?PHP Database::getLog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Database\Database的用法示例。


在下文中一共展示了Database::getLog方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: endQueryCapture

 /**
  * Add the list of queries run during render to buildinfo.
  *
  * @see ViewUI::startQueryCapture()
  */
 public function endQueryCapture()
 {
     $queries = Database::getLog('views');
     $this->additionalQueries = $queries;
 }
開發者ID:ddrozdik,項目名稱:dmaps,代碼行數:10,代碼來源:ViewUI.php

示例2: testEnableMultiConnectionLogging

 /**
  * Tests that we can log queries separately on different connections.
  */
 function testEnableMultiConnectionLogging()
 {
     // Clone the primary credentials to a fake connection.
     // That both connections point to the same physical database is irrelevant.
     $connection_info = Database::getConnectionInfo('default');
     Database::addConnectionInfo('test2', 'default', $connection_info['default']);
     Database::startLog('testing1');
     Database::startLog('testing1', 'test2');
     db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
     $old_key = db_set_active('test2');
     db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'replica'))->fetchCol();
     db_set_active($old_key);
     $queries1 = Database::getLog('testing1');
     $queries2 = Database::getLog('testing1', 'test2');
     $this->assertEqual(count($queries1), 1, 'Correct number of queries recorded for first connection.');
     $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for second connection.');
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:20,代碼來源:LoggingTest.php

示例3: getLog

 public static final function getLog($logging_key, $key = 'default')
 {
     return BaseDatabase::getLog($logging_key, $key);
 }
開發者ID:EarthTeam,項目名稱:earthteam.net,代碼行數:4,代碼來源:Database.php

示例4: logResponse

 /**
  * Log the termination of a request.
  *
  * @param Response $response
  * @param Request  $request
  */
 protected function logResponse(Response $response, Request $request)
 {
     $queries = Database::getLog('console_logger', 'default');
     $sum = 0;
     if (!empty($queries)) {
         foreach ($queries as $query) {
             $text[] = $query['query'];
             $sum += $query['time'];
         }
         $querySummary = 'Executed {queries} queries in {time_ms} ms.';
         $this->logger->log($this->logLevel, $querySummary, ['queries' => count($queries), 'time_ms' => round($sum * 1000, 2)]);
     }
     if ($response->headers->has('x-debug-token-link')) {
         $this->logger->log($this->logLevel, 'Profiler at {url}', ['url' => $GLOBALS['base_url'] . $response->headers->get('x-debug-token-link')]);
     }
 }
開發者ID:caxy,項目名稱:drupal-console-logging-middleware,代碼行數:22,代碼來源:ProfilerLoggingMiddleware.php

示例5: testGetLoggingWrongKey

 /**
  * Tests that getLog with a wrong key return an empty array.
  */
 function testGetLoggingWrongKey()
 {
     $result = Database::getLog('wrong');
     $this->assertEqual($result, [], 'The function getLog with a wrong key returns an empty array.');
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:8,代碼來源:LoggingTest.php


注:本文中的Drupal\Core\Database\Database::getLog方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。