当前位置: 首页>>代码示例>>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;未经允许,请勿转载。