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


PHP Database::startLog方法代码示例

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


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

示例1: handle

 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
 {
     foreach (Database::getAllConnectionInfo() as $key => $info) {
         Database::startLog('webprofiler', $key);
     }
     return $this->httpKernel->handle($request, $type, $catch);
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:10,代码来源:WebprofilerMiddleware.php

示例2: __construct

 public function __construct()
 {
     // Starts timers and logs.
     Timer::start(self::class);
     if (!isset(self::$logger)) {
         self::$logger = Database::startLog(self::class);
     }
 }
开发者ID:caxy,项目名称:drupal-console-logging-middleware,代码行数:8,代码来源:DrupalProfilingProcessor.php

示例3: handle

 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
 {
     Timer::start('devel_page');
     if ($this->config->get('memory')) {
         // TODO: Avoid global.
         global $memory_init;
         $memory_init = memory_get_usage();
     }
     if ($this->config->get('query_display')) {
         Database::startLog('devel');
     }
     return $this->httpKernel->handle($request, $type, $catch);
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:16,代码来源:DevelMiddleware.php

示例4: onRequest

 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if (!devel_silent()) {
         if ($this->config->get('memory')) {
             global $memory_init;
             $memory_init = memory_get_usage();
         }
         if (devel_query_enabled()) {
             Database::startLog('devel');
         }
         if ($this->account->hasPermission('access devel information')) {
             devel_set_handler(devel_get_handlers());
             // We want to include the class early so that anyone may call krumo()
             // as needed. See http://krumo.sourceforge.net/
             has_krumo();
             // See http://www.firephp.org/HQ/Install.htm
             $path = NULL;
             if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                 // FirePHPCore is in include_path. Probably a PEAR installation.
                 $path = '';
             } elseif ($this->moduleHandler->moduleExists('libraries')) {
                 // Support Libraries API - http://drupal.org/project/libraries
                 $firephp_path = libraries_get_path('FirePHPCore');
                 $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                 $chromephp_path = libraries_get_path('chromephp');
             } else {
                 $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
                 $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
             }
             // Include FirePHP if it exists.
             if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                 include_once $firephp_path . 'fb.php';
                 include_once $firephp_path . 'FirePHP.class.php';
             }
             // Include ChromePHP if it exists.
             if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                 include_once $chromephp_path;
             }
         }
     }
     if ($this->config->get('rebuild_theme_registry')) {
         drupal_theme_rebuild();
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_registry_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_registry_warning');
             if (!devel_silent() && $this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme registry is being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/config/development/devel'))));
             }
         }
     }
     drupal_register_shutdown_function('devel_shutdown');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:54,代码来源:DevelEventSubscriber.php

示例5: logRequest

 /**
  * Log an incoming request from the middleware.
  *
  * @param Request $request
  *                         The incoming request.
  * @param int     $type
  *                         The type of request (master or sub request).
  */
 protected function logRequest(Request $request, $type = HttpKernelInterface::MASTER_REQUEST)
 {
     if ($type == HttpKernelInterface::MASTER_REQUEST) {
         // Starts timers and logs.
         Database::startLog('console_logger');
         if ($request->getRealMethod() == 'POST') {
             $parameters = $request->request->all();
             $parameters = $this->sanitizeParameters($parameters);
             if (!empty($parameters)) {
                 $this->logger->log($this->logLevel, 'Request parameters', $parameters);
             }
         }
     }
 }
开发者ID:caxy,项目名称:drupal-console-logging-middleware,代码行数:22,代码来源:ProfilerLoggingMiddleware.php

示例6: startQueryCapture

 /**
  * Set up query capturing.
  *
  * \Drupal\Core\Database\Database stores the queries that it runs, if logging
  * is enabled.
  *
  * @see ViewUI::endQueryCapture()
  */
 public function startQueryCapture()
 {
     Database::startLog('views');
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:ViewUI.php

示例7: 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

示例8: startLog

 public static final function startLog($logging_key, $key = 'default')
 {
     return BaseDatabase::startLog($logging_key, $key);
 }
开发者ID:EarthTeam,项目名称:earthteam.net,代码行数:4,代码来源:Database.php

示例9: handle

 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
 {
     Database::startLog('webprofiler');
     return $this->httpKernel->handle($request, $type, $catch);
 }
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:8,代码来源:WebprofilerMiddleware.php

示例10: onRequest

 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if (!devel_silent()) {
         if ($this->config->get('memory')) {
             global $memory_init;
             $memory_init = memory_get_usage();
         }
         if (devel_query_enabled()) {
             Database::startLog('devel');
         }
         if ($this->account->hasPermission('access devel information')) {
             devel_set_handler(devel_get_handlers());
             // We want to include the class early so that anyone may call krumo()
             // as needed. See http://krumo.sourceforge.net/
             has_krumo();
             // See http://www.firephp.org/HQ/Install.htm
             $path = NULL;
             if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                 // FirePHPCore is in include_path. Probably a PEAR installation.
                 $path = '';
             } elseif ($this->moduleHandler->moduleExists('libraries')) {
                 // Support Libraries API - http://drupal.org/project/libraries
                 $firephp_path = libraries_get_path('FirePHPCore');
                 $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                 $chromephp_path = libraries_get_path('chromephp');
             } else {
                 $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
                 $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
             }
             // Include FirePHP if it exists.
             if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                 include_once $firephp_path . 'fb.php';
                 include_once $firephp_path . 'FirePHP.class.php';
             }
             // Include ChromePHP if it exists.
             if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                 include_once $chromephp_path;
             }
         }
     }
     if ($this->config->get('rebuild_theme')) {
         drupal_theme_rebuild();
         // Ensure that the active theme object is cleared.
         $theme_name = \Drupal::theme()->getActiveTheme()->getName();
         \Drupal::state()->delete('theme.active_theme.' . $theme_name);
         \Drupal::theme()->resetActiveTheme();
         /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
         $theme_handler = \Drupal::service('theme_handler');
         $theme_handler->refreshInfo();
         // @todo This is not needed after https://www.drupal.org/node/2330755
         $list = $theme_handler->listInfo();
         $theme_handler->addTheme($list[$theme_name]);
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_theme_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_theme_warning');
             if (!devel_silent() && $this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme information is being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => $this->urlGenerator->generateFromRoute('devel.admin_settings'))));
             }
         }
     }
     drupal_register_shutdown_function('devel_shutdown');
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:64,代码来源:DevelEventSubscriber.php


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