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


PHP Piwik\Log类代码示例

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


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

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

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

示例4: purgeData

 /**
  * Purges old data from the following tables:
  * - log_visit
  * - log_link_visit_action
  * - log_conversion
  * - log_conversion_item
  * - log_action
  */
 public function purgeData()
 {
     $maxIdVisit = $this->getDeleteIdVisitOffset();
     // break if no ID was found (nothing to delete for given period)
     if (empty($maxIdVisit)) {
         return;
     }
     $logTables = self::getDeleteTableLogTables();
     // delete data from log tables
     $where = "WHERE idvisit <= ?";
     foreach ($logTables as $logTable) {
         // deleting from log_action must be handled differently, so we do it later
         if ($logTable != Common::prefixTable('log_action')) {
             Db::deleteAllRows($logTable, $where, "idvisit ASC", $this->maxRowsToDeletePerQuery, array($maxIdVisit));
         }
     }
     // delete unused actions from the log_action table (but only if we can lock tables)
     if (Db::isLockPrivilegeGranted()) {
         $this->purgeUnusedLogActions();
     } else {
         $logMessage = get_class($this) . ": LOCK TABLES privilege not granted; skipping unused actions purge";
         Log::warning($logMessage);
     }
     // optimize table overhead after deletion
     Db::optimizeTables($logTables);
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:34,代码来源:LogDataPurger.php

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

示例6: updateTracker

 public function updateTracker()
 {
     try {
         $trackerUpdater = new TrackerUpdater();
         $trackerUpdater->update();
     } catch (\Exception $e) {
         Log::error('There was an error while updating the javascript tracker: ' . $e->getMessage());
     }
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:9,代码来源:CustomPiwikJs.php

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

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

示例9: logVariables

 public function logVariables()
 {
     try {
         if (isset($_SERVER['QUERY_STRING'])) {
             \Piwik\Log::verbose("Test Environment Variables for (%s):\n%s", $_SERVER['QUERY_STRING'], print_r($this->behaviorOverrideProperties, true));
         }
     } catch (Exception $ex) {
         // ignore
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:10,代码来源:TestingEnvironment.php

示例10: it_should_add_severity_for_errors

 /**
  * @test
  */
 public function it_should_add_severity_for_errors()
 {
     $processor = new ExceptionToTextProcessor();
     Log::$debugBacktraceForTests = '[stack trace]';
     $exception = new \ErrorException('Hello world', 0, 1, 'file.php', 123);
     $record = array('context' => array('exception' => $exception));
     $result = $processor($record);
     $expected = array('message' => "file.php(123): Error - Hello world\n[stack trace]", 'context' => array('exception' => $exception));
     $this->assertEquals($expected, $result);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:13,代码来源:ExceptionToTextProcessorTest.php

示例11: addCommandIfExists

 private function addCommandIfExists($command)
 {
     if (!class_exists($command)) {
         Log::warning(sprintf('Cannot add command %s, class does not exist', $command));
     } elseif (!is_subclass_of($command, 'Piwik\\Plugin\\ConsoleCommand')) {
         Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\\Plugin\\ConsoleCommand', $command));
     } else {
         $this->add(new $command());
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:10,代码来源:Console.php

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

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

示例14: run

 public function run()
 {
     $console = new Application();
     $commands = $this->getAvailableCommands();
     foreach ($commands as $command) {
         if (!class_exists($command)) {
             Log::warning(sprintf('Cannot add command %s, class does not exist', $command));
         } elseif (!is_subclass_of($command, 'Piwik\\Plugin\\ConsoleCommand')) {
             Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\\Plugin\\ConsoleCommand', $command));
         } else {
             $console->add(new $command());
         }
     }
     $console->run();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:15,代码来源:Console.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = $input->getOption('url');
     if ($input->getOption('piwik-domain') && !$url) {
         $_SERVER['argv'][] = '--url=' . $input->getOption('piwik-domain');
     }
     if (is_string($url) && $url && in_array($url, array('http://', 'https://'))) {
         // see http://dev.piwik.org/trac/ticket/5180 and http://forum.piwik.org/read.php?2,115274
         throw new \InvalidArgumentException('No valid URL given. If you have specified a valid URL try --piwik-domain instead of --url');
     }
     if ($input->getOption('verbose')) {
         Log::getInstance()->setLogLevel(Log::VERBOSE);
     }
     include PIWIK_INCLUDE_PATH . '/misc/cron/archive.php';
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:15,代码来源:CoreArchiver.php


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