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


PHP Log::debug方法代码示例

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


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

示例1: getErrorResponse

 private static function getErrorResponse(Exception $ex)
 {
     $debugTrace = $ex->getTraceAsString();
     $message = $ex->getMessage();
     if (!method_exists($ex, 'isHtmlMessage') || !$ex->isHtmlMessage()) {
         $message = Common::sanitizeInputValue($message);
     }
     $logo = new CustomLogo();
     $logoHeaderUrl = false;
     $logoFaviconUrl = false;
     try {
         $logoHeaderUrl = $logo->getHeaderLogoUrl();
         $logoFaviconUrl = $logo->getPathUserFavicon();
     } catch (Exception $ex) {
         Log::debug($ex);
     }
     $result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl);
     /**
      * Triggered before a Piwik error page is displayed to the user.
      *
      * This event can be used to modify the content of the error page that is displayed when
      * an exception is caught.
      *
      * @param string &$result The HTML of the error page.
      * @param Exception $ex The Exception displayed in the error page.
      */
     Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex));
     return $result;
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:29,代码来源:ExceptionHandler.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Set memory limit to off
     @ini_set('memory_limit', -1);
     Piwik::doAsSuperUser(function () use($input, $output) {
         $settings = new MigratorSettings();
         $settings->idSite = $input->getArgument('idSite');
         $settings->site = $this->getSite($settings->idSite);
         $settings->dateFrom = $input->getOption('date-from') ? new \DateTime($input->getOption('date-from')) : null;
         $settings->dateTo = $input->getOption('date-to') ? new \DateTime($input->getOption('date-to')) : null;
         $settings->skipArchiveData = $input->getOption('skip-archive-data');
         $settings->skipLogData = $input->getOption('skip-log-data');
         $config = Db::getDatabaseConfig();
         $startTime = microtime(true);
         $this->createTargetDatabaseConfig($input, $output, $config);
         $tmpConfig = $config;
         $sourceDb = Db::get();
         try {
             $targetDb = @Db\Adapter::factory($config['adapter'], $tmpConfig);
         } catch (\Exception $e) {
             throw new \RuntimeException('Unable to connect to the target database: ' . $e->getMessage(), 0, $e);
         }
         $sourceDbHelper = new DBHelper($sourceDb, Db::getDatabaseConfig());
         $migratorFacade = new Migrator($sourceDbHelper, new DBHelper($targetDb, $config), GCHelper::getInstance(), $settings, new ArchiveLister($sourceDbHelper));
         $migratorFacade->migrate();
         $endTime = microtime(true);
         Log::debug(sprintf('Time taken: %01.2f sec', $endTime - $startTime));
         Log::debug(sprintf('Peak memory usage: %01.2f MB', memory_get_peak_usage(true) / 1048576));
     });
 }
开发者ID:saadouus,项目名称:plugin-SiteMigration,代码行数:30,代码来源:MigrateSite.php

示例3: factory

 /**
  * Create a component instance that exists within a specific plugin. Uses the component's
  * unqualified class name and expected base type.
  *
  * This method will only create a class if it is located within the component type's
  * associated subdirectory.
  *
  * @param string $pluginName The name of the plugin the component is expected to belong to,
  *                           eg, `'UserSettings'`.
  * @param string $componentClassSimpleName The component's class name w/o namespace, eg,
  *                                         `"GetKeywords"`.
  * @param string $componentTypeClass The fully qualified class name of the component type, eg,
  *                                   `"Piwik\Plugin\Report"`.
  * @return mixed|null A new instance of the desired component or null if not found. If the
  *                    plugin is not loaded or activated or the component is not located in
  *                    in the sub-namespace specified by `$componentTypeClass::COMPONENT_SUBNAMESPACE`,
  *                    this method will return null.
  */
 public static function factory($pluginName, $componentClassSimpleName, $componentTypeClass)
 {
     if (empty($pluginName) || empty($componentClassSimpleName)) {
         return null;
     }
     $pluginManager = PluginManager::getInstance();
     try {
         if (!$pluginManager->isPluginActivated($pluginName)) {
             return null;
         }
         $plugin = $pluginManager->getLoadedPlugin($pluginName);
     } catch (Exception $e) {
         Log::debug($e);
         return null;
     }
     $subnamespace = $componentTypeClass::COMPONENT_SUBNAMESPACE;
     $desiredComponentClass = 'Piwik\\Plugins\\' . $pluginName . '\\' . $subnamespace . '\\' . $componentClassSimpleName;
     $components = $plugin->findMultipleComponents($subnamespace, $componentTypeClass);
     foreach ($components as $class) {
         if ($class == $desiredComponentClass) {
             return new $class();
         }
     }
     return null;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:43,代码来源:ComponentFactory.php

示例4: deleteArchivesWithPeriodRange

 protected static function deleteArchivesWithPeriodRange(Date $date)
 {
     $numericTable = ArchiveTableCreator::getNumericTable($date);
     $blobTable = ArchiveTableCreator::getBlobTable($date);
     $yesterday = Date::factory('yesterday')->getDateTime();
     Log::debug("Purging Custom Range archives: done [ purged archives older than %s from %s / blob ]", $yesterday, $numericTable);
     self::getModel()->deleteArchivesWithPeriodRange($numericTable, $blobTable, Piwik::$idPeriods['range'], $yesterday);
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:8,代码来源:ArchivePurger.php

示例5: testConnection

 public function testConnection()
 {
     try {
         $this->connectIfNeeded();
         return 'TEST' === $this->redis->echo('TEST');
     } catch (\Exception $e) {
         Log::debug($e->getMessage());
     }
     return false;
 }
开发者ID:ruchitrami,项目名称:plugin-QueuedTracking,代码行数:10,代码来源:Redis.php

示例6: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     Log::debug("Tearing down " . get_called_class());
     if (!isset(static::$fixture)) {
         $fixture = new Fixture();
     } else {
         $fixture = static::$fixture;
     }
     $fixture->performTearDown();
 }
开发者ID:mgou-net,项目名称:piwik,代码行数:10,代码来源:SystemTestCase.php

示例7: migrate

 public function migrate($siteId, \DateTime $from = null, \DateTime $to = null)
 {
     $archives = $this->archiveLister->getArchiveList($from, $to);
     foreach ($archives as $archiveDate) {
         Log::debug('Migrating archive ' . $archiveDate);
         $this->migrateArchive($archiveDate, 'archive_numeric_' . $archiveDate, $siteId);
         try {
             $this->migrateArchive($archiveDate, 'archive_blob_' . $archiveDate, $siteId);
         } catch (\Exception $e) {
             // blob tables can be missing
         }
     }
 }
开发者ID:saadouus,项目名称:plugin-SiteMigration,代码行数:13,代码来源:ArchiveMigrator.php

示例8: deleteArchivesWithPeriodRange

 protected static function deleteArchivesWithPeriodRange(Date $date)
 {
     $query = "DELETE FROM %s WHERE period = ? AND ts_archived < ?";
     $yesterday = Date::factory('yesterday')->getDateTime();
     $bind = array(Piwik::$idPeriods['range'], $yesterday);
     $numericTable = ArchiveTableCreator::getNumericTable($date);
     Db::query(sprintf($query, $numericTable), $bind);
     Log::debug("Purging Custom Range archives: done [ purged archives older than %s from %s / blob ]", $yesterday, $numericTable);
     try {
         Db::query(sprintf($query, ArchiveTableCreator::getBlobTable($date)), $bind);
     } catch (Exception $e) {
         // Individual blob tables could be missing
     }
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:14,代码来源:ArchivePurger.php

示例9: getErrorResponse

 private static function getErrorResponse(Exception $ex)
 {
     $debugTrace = $ex->getTraceAsString();
     $message = $ex->getMessage();
     $isHtmlMessage = method_exists($ex, 'isHtmlMessage') && $ex->isHtmlMessage();
     if (!$isHtmlMessage && Request::isApiRequest($_GET)) {
         $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST));
         $response = new ResponseBuilder($outputFormat);
         return $response->getResponseException($ex);
     } elseif (!$isHtmlMessage) {
         $message = Common::sanitizeInputValue($message);
     }
     $logo = new CustomLogo();
     $logoHeaderUrl = false;
     $logoFaviconUrl = false;
     try {
         $logoHeaderUrl = $logo->getHeaderLogoUrl();
         $logoFaviconUrl = $logo->getPathUserFavicon();
     } catch (Exception $ex) {
         try {
             Log::debug($ex);
         } catch (\Exception $otherEx) {
             // DI container may not be setup at this point
         }
     }
     $result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl);
     try {
         /**
          * Triggered before a Piwik error page is displayed to the user.
          *
          * This event can be used to modify the content of the error page that is displayed when
          * an exception is caught.
          *
          * @param string &$result The HTML of the error page.
          * @param Exception $ex The Exception displayed in the error page.
          */
         Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex));
     } catch (ContainerDoesNotExistException $ex) {
         // this can happen when an error occurs before the Piwik environment is created
     }
     return $result;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:42,代码来源:ExceptionHandler.php

示例10: getCommonVisitorCount

 /**
  * Computes the total number of unique visitors who visited at least one site in,
  * a set of sites and the number of unique visitors that visited all of the sites
  * in the set.
  *
  * Comparison is done in dates for the UTC time, not for the site specific time.
  *
  * Performance: The SQL query this method executes was tested on a Piwik instance
  *              with 13 million visits total. Computing data for 4 sites with no
  *              date limit took 13s to complete.
  *
  * @param int[] $idSites The IDs of the sites for whom unique visitor counts should be
  *                       computed.
  * @param Date $startDate The lower bound of the date range of the visits to check.
  * @param Date $endDate The upper bound of the date range of the visits to check.
  * @param Segment $segment An optional segment to apply to the visits set before aggregation.
  *                         To supply no segment, use `new Segment()`.
  * @return int[] Returns two metrics: **nb_total_visitors** and **nb_shared_visitors**.
  *
  *               **nb_total_visitors** is the total number of unique visitors who visited
  *               at least one site in the list.
  *
  *               **nb_shared_visitors** is the total number of unique visitors who visited
  *               every site in the list.
  * @throws Exception if less than 2 site IDs are supplied,
  */
 public function getCommonVisitorCount($idSites, Date $startDate, Date $endDate, Segment $segment)
 {
     Log::debug("%s::%s('%s', '%s', '%s', '%s') called", "Model\\DistinctMetricsAggregator", __FUNCTION__, $idSites, $startDate, $endDate, $segment);
     if (count($idSites) == 1) {
         throw new Exception(Piwik::translate('InterSites_PleasSupplyAtLeastTwoDifferentSites'));
     }
     $select = "config_id, COUNT(DISTINCT idsite) AS sitecount";
     $from = array('log_visit');
     $where = 'visit_last_action_time >= ? AND visit_last_action_time <= ? AND idsite IN (' . Common::getSqlStringFieldsArray($idSites) . ')';
     $orderBy = false;
     $groupBy = 'config_id';
     $startDateTime = new \DateTime($startDate->toString());
     $endDateTime = new \DateTime($endDate->toString());
     $bind = array_merge(array($startDateTime->format("Y-m-d 00:00:00"), $endDateTime->format("Y-m-d 23:59:59")), $idSites);
     $innerQuery = $segment->getSelectQuery($select, $from, $where, $bind, $orderBy, $groupBy);
     $wholeQuery = "SELECT COUNT(sitecount_by_config.config_id) AS nb_total_visitors,\n                              SUM(IF(sitecount_by_config.sitecount >= " . count($idSites) . ", 1, 0)) AS nb_shared_visitors\n                         FROM ( {$innerQuery['sql']} ) AS sitecount_by_config";
     $result = Db::fetchRow($wholeQuery, $innerQuery['bind']);
     // nb_shared_visitors can be NULL if there are no visits
     if ($result['nb_shared_visitors'] === null) {
         $result['nb_shared_visitors'] = 0;
     }
     Log::debug("%s::%s() returned '%s'", "Model\\DistinctMetricsAggregator", __FUNCTION__, $result);
     return $result;
 }
开发者ID:PiwikPRO,项目名称:plugin-InterSites,代码行数:50,代码来源:DistinctMetricsAggregator.php

示例11: installLoadedPlugins

 /**
  * Install loaded plugins
  *
  * @throws
  * @return array Error messages of plugin install fails
  */
 public function installLoadedPlugins()
 {
     Log::debug("Loaded plugins: " . implode(", ", array_keys($this->getLoadedPlugins())));
     $messages = array();
     foreach ($this->getLoadedPlugins() as $plugin) {
         try {
             $this->installPluginIfNecessary($plugin);
         } catch (\Exception $e) {
             $messages[] = $e->getMessage();
         }
     }
     return $messages;
 }
开发者ID:962464,项目名称:piwik,代码行数:19,代码来源:Manager.php

示例12: loadAllPlugins

 public static function loadAllPlugins($testEnvironment = null, $testCaseClass = false, $extraPluginsToLoad = array())
 {
     if (empty($testEnvironment)) {
         $testEnvironment = new Piwik_TestingEnvironment();
     }
     DbHelper::createTables();
     $pluginsManager = \Piwik\Plugin\Manager::getInstance();
     $plugins = $testEnvironment->getCoreAndSupportedPlugins();
     // make sure the plugin that executed this method is included in the plugins to load
     $extraPlugins = array_merge($extraPluginsToLoad, array(\Piwik\Plugin::getPluginNameFromBacktrace(debug_backtrace()), \Piwik\Plugin::getPluginNameFromNamespace($testCaseClass), \Piwik\Plugin::getPluginNameFromNamespace(get_called_class())));
     foreach ($extraPlugins as $pluginName) {
         if (empty($pluginName)) {
             continue;
         }
         if (in_array($pluginName, $plugins)) {
             continue;
         }
         $plugins[] = $pluginName;
         if ($testEnvironment) {
             $testEnvironment->pluginsToLoad = array_merge($testEnvironment->pluginsToLoad ?: array(), array($pluginName));
         }
     }
     Log::debug("Plugins to load during tests: " . implode(', ', $plugins));
     $pluginsManager->loadPlugins($plugins);
 }
开发者ID:igorclark,项目名称:piwik,代码行数:25,代码来源:Fixture.php

示例13: logSql

 private static function logSql($functionName, $sql, $parameters = array())
 {
     if (self::$logQueries === false || @Config::getInstance()->Debug['log_sql_queries'] != 1) {
         return;
     }
     // NOTE: at the moment we don't log parameters in order to avoid sensitive information leaks
     Log::debug("Db::%s() executing SQL: %s", $functionName, $sql);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:Db.php

示例14: renderTwigTemplate

 protected function renderTwigTemplate()
 {
     try {
         $output = $this->twig->render($this->getTemplateFile(), $this->getTemplateVars());
     } catch (Exception $ex) {
         // twig does not rethrow exceptions, it wraps them so we log the cause if we can find it
         $cause = $ex->getPrevious();
         Log::debug($cause === null ? $ex : $cause);
         throw $ex;
     }
     $output = $this->applyFilter_cacheBuster($output);
     $helper = new Theme();
     $output = $helper->rewriteAssetsPathToTheme($output);
     return $output;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:15,代码来源:View.php

示例15: process

 /**
  * Dispatches the API request to the appropriate API method and returns the result
  * after post-processing.
  *
  * Post-processing includes:
  *
  * - flattening if **flat** is 0
  * - running generic filters unless **disable_generic_filters** is set to 1
  * - URL decoding label column values
  * - running queued filters unless **disable_queued_filters** is set to 1
  * - removing columns based on the values of the **hideColumns** and **showColumns** query parameters
  * - filtering rows if the **label** query parameter is set
  * - converting the result to the appropriate format (ie, XML, JSON, etc.)
  *
  * If `'original'` is supplied for the output format, the result is returned as a PHP
  * object.
  *
  * @throws PluginDeactivatedException if the module plugin is not activated.
  * @throws Exception if the requested API method cannot be called, if required parameters for the
  *                   API method are missing or if the API method throws an exception and the **format**
  *                   query parameter is **original**.
  * @return DataTable|Map|string The data resulting from the API call.
  */
 public function process()
 {
     // read the format requested for the output data
     $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $this->request));
     // create the response
     $response = new ResponseBuilder($outputFormat, $this->request);
     $corsHandler = new CORSHandler();
     $corsHandler->handle();
     try {
         // read parameters
         $moduleMethod = Common::getRequestVar('method', null, 'string', $this->request);
         list($module, $method) = $this->extractModuleAndMethod($moduleMethod);
         $module = $this->renameModule($module);
         if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated($module)) {
             throw new PluginDeactivatedException($module);
         }
         $apiClassName = $this->getClassNameAPI($module);
         self::reloadAuthUsingTokenAuth($this->request);
         // call the method
         $returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request);
         $toReturn = $response->getResponse($returnedValue, $module, $method);
     } catch (Exception $e) {
         Log::debug($e);
         $toReturn = $response->getResponseException($e);
     }
     return $toReturn;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:50,代码来源:Request.php


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