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


PHP Logger::warning方法代码示例

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


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

示例1: update

 public function update(Worker $worker)
 {
     /** @var EntityManager $em */
     $em = $this->doctrine->getManager();
     $exception = null;
     $i = 0;
     while ($i < 5) {
         try {
             $worker = $this->getWorker(['queue' => $worker->getQueue(), 'instance' => $worker->getInstance(), 'host' => $worker->getHost()]);
             $em->persist($worker);
             $em->flush();
             return;
         } catch (\Exception $e) {
             // the connection might have "gone away"
             $this->logger->warning("Error while updating worker entity", ['message' => $e->getMessage()]);
             $exception = $e;
             $this->doctrine->resetManager();
             $em = $this->doctrine->getManager();
             $em->getConnection()->close();
             $em->getConnection()->connect();
         }
         $i++;
     }
     throw new ApplicationException("Unable to update worker entity", $exception);
 }
开发者ID:keboola,项目名称:syrup-queue,代码行数:25,代码来源:WorkerManager.php

示例2: validateHeader

 private function validateHeader($data, $name)
 {
     if (!$data[0] instanceof \stdClass || !is_array($data[1])) {
         $mes = "Incorrect input param type for {$name}";
         if (isset($this->logger)) {
             $this->logger->warning('ACCESS', ['Cause' => $mes]);
         }
         throw new \Exception($mes);
     }
 }
开发者ID:frobou,项目名称:frobou-validator,代码行数:10,代码来源:FrobouValidatorAbstract.php

示例3: testLogsFileAndLineWhenUsingIntrospectionProcessor

 public function testLogsFileAndLineWhenUsingIntrospectionProcessor()
 {
     $this->logger->pushProcessor(new IntrospectionProcessor());
     $this->logger->warning('a warning');
     $line = __LINE__;
     $log = $this->pdo->query('SELECT * FROM logs')->fetch();
     $this->assertTrue(isset($log['file']));
     $this->assertTrue(isset($log['line']));
     $this->assertEquals($log['message'], 'a warning');
     $this->assertEquals($log['file'], __FILE__);
     $this->assertEquals($log['line'], $line);
 }
开发者ID:kafene,项目名称:monolog-pdo-handler,代码行数:12,代码来源:PdoHandlerTest.php

示例4: getData

 /**
  * Fetches the data for the given IP address
  *
  * @return $this
  */
 public function getData()
 {
     $url = $this->getUrl();
     try {
         $response = $this->connector->{$this->method}($url);
         $this->parseData($response->body);
     } catch (\Exception $exception) {
         if ($this->logger) {
             $this->logger->warning('IP LOOKUP: ' . $exception->getMessage());
         }
     }
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:17,代码来源:AbstractIpLookup.php

示例5: stopDaemon

 protected function stopDaemon()
 {
     if (!file_exists(PHPCI_DIR . '/daemon/daemon.pid')) {
         echo "Not started\n";
         $this->logger->warning("Can't stop daemon as not started");
         return "notstarted";
     }
     $cmd = "kill \$(cat %s/daemon/daemon.pid)";
     $command = sprintf($cmd, PHPCI_DIR);
     exec($command);
     $this->logger->info("Daemon stopped");
     unlink(PHPCI_DIR . '/daemon/daemon.pid');
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:13,代码来源:DaemonCommand.php

示例6: weight

 private function weight($imageRegion)
 {
     // Outros efectos para mellorar
     //$imageRegion->negateImage(true);
     //$imageRegion->fxImage('intensity');
     //$imageRegion->contrastImage(1);
     $imageRegion->whiteThresholdImage('#EEE');
     $imageRegion->blackThresholdImage('#EEE');
     /*$basename = $this->basedir . '/%02d.png';
       $imageRegion->writeImage( sprintf($basename, $this->i++) );*/
     // Contar pixels
     $it = new \ImagickPixelIterator($imageRegion);
     //$whitePixel = new \ImagickPixel('#000');
     $whitePixel = new \ImagickPixel('#FFF');
     $totalPixels = 0;
     $dirtyPixels = 0;
     foreach ($it as $pixels) {
         foreach ($pixels as $column => $pixel) {
             if (!$pixel->isSimilar($whitePixel, 0.1)) {
                 $dirtyPixels++;
             }
             $totalPixels++;
         }
         $it->syncIterator();
     }
     $percent = $dirtyPixels * 100 / $totalPixels;
     //dump($percent);
     $this->logger->warning('%: ' . $percent);
     return $percent;
 }
开发者ID:vifito,项目名称:compromiso-calidade,代码行数:30,代码来源:Scanner.php

示例7: syncGroupUsers

 /**
  * @param Group $group
  * @param int   $offset
  */
 private function syncGroupUsers(Group $group, $offset = 0)
 {
     $this->logger->info(' - Processing users for Group `' . $group->getName() . '` ' . $offset . ' to ' . ($offset + self::BATCH_SIZE) . '...');
     $ldapUsers = $this->ldap->findGroupUsers($group->getReference(), $offset, self::BATCH_SIZE);
     $grouphubUsers = $this->api->findGroupUsers($group, $offset, self::BATCH_SIZE);
     // Nothing to sync, or done syncing
     if (count($ldapUsers) === 0 && count($grouphubUsers) === 0) {
         $this->logger->info(' - Done syncing Group users!');
         return;
     }
     $index = $grouphubUsers->synchronize($ldapUsers, true);
     $this->logger->info(' -- Going to add ' . count($grouphubUsers->getAddedElements()) . ' users for Group to Grouphub...');
     foreach ($grouphubUsers->getAddedElements() as $element) {
         /** @var User $element */
         $user = $this->api->findUserByReference($element->getReference());
         if (!$user) {
             $this->logger->warning(' -- Skipping user with ref ' . $element->getReference() . ' because it cannot be found in the API?!?');
             continue;
         }
         try {
             $this->api->addGroupUser($group->getId(), $user->getId());
         } catch (\Exception $e) {
             $this->logger->warning(' -- Failed adding user with ref ' . $element->getReference() . ' message: ' . $e->getMessage());
         }
     }
     $this->logger->info(' -- Going to remove ' . count($grouphubUsers->getRemovedElements()) . ' users for Group from Grouphub...');
     foreach ($grouphubUsers->getRemovedElements() as $element) {
         /** @var User $element */
         $this->api->removeGroupUser($group->getId(), $element->getId());
     }
     $this->syncGroupUsers($group, $offset + $index + 1);
 }
开发者ID:SURFnet,项目名称:grouphub,代码行数:36,代码来源:SyncService.php

示例8: stopDaemon

 protected function stopDaemon()
 {
     $pid = $this->getRunningPid();
     if (!$pid) {
         $this->logger->notice("Cannot stop the daemon as it is not started");
         return "notstarted";
     }
     $this->logger->info("Trying to terminate the daemon", array('pid' => $pid));
     $this->processControl->kill($pid);
     for ($i = 0; ($pid = $this->getRunningPid()) && $i < 5; $i++) {
         sleep(1);
     }
     if ($pid) {
         $this->logger->warning("The daemon is resiting, trying to kill it", array('pid' => $pid));
         $this->processControl->kill($pid, true);
         for ($i = 0; ($pid = $this->getRunningPid()) && $i < 5; $i++) {
             sleep(1);
         }
     }
     if (!$pid) {
         $this->logger->notice("Daemon stopped");
         return "stopped";
     }
     $this->logger->error("Could not stop the daemon");
 }
开发者ID:DavidGarciaCat,项目名称:PHPCI,代码行数:25,代码来源:DaemonCommand.php

示例9: createLogger

 protected function createLogger($path, $level = Logger::WARNING)
 {
     $logger = new Logger('app');
     $logger->pushProcessor(new PsrLogMessageProcessor());
     if (is_writable($path) || is_writable(dirname($path))) {
         $logger->pushHandler(new StreamHandler($path, $level));
     } else {
         if ($this->app->isDebug()) {
             throw new DCException("Log path '{$path}' is not writable. Make sure your logger.path of config.");
         }
         $logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $level));
         $logger->warning("Log path '{$path}' is not writable. Make sure your logger.path of config.");
         $logger->warning("error_log() is used for application logger instead at this time.");
     }
     return $logger;
 }
开发者ID:oh-sky,项目名称:dietcube,代码行数:16,代码来源:Dispatcher.php

示例10: extract

 protected function extract(Account $account, Profile $profile, $tableName, $dateFrom, $dateTo)
 {
     $config = $account->getConfiguration();
     $cfg = $config[$tableName];
     $filters = isset($cfg['filters'][0]) ? $cfg['filters'][0] : null;
     $segment = isset($cfg['segment']) ? $cfg['segment'] : null;
     $resultSet = $this->gaApi->getData($profile->getGoogleId(), $cfg['dimensions'], $cfg['metrics'], $filters, $segment, $dateFrom, $dateTo);
     $this->logger->info("Extracting ...", ['dimensions' => $cfg['dimensions'], 'metrics' => $cfg['metrics'], 'dateFrom' => $dateFrom, 'dateTo' => $dateTo, 'results' => count($resultSet)]);
     if (empty($resultSet)) {
         $this->logger->warning("Query returned empty result", ['account' => $account->getAccountName(), 'profile' => $profile->getName(), 'outputTable' => $tableName]);
         return;
     }
     $csv = $this->getOutputCsv($tableName, $profile);
     $this->getDataManager()->saveToCsv($resultSet, $profile, $csv);
     // Paging
     $params = $this->gaApi->getDataParameters();
     if ($params['totalResults'] > $params['itemsPerPage']) {
         $pages = ceil($params['totalResults'] / $params['itemsPerPage']);
         for ($i = 1; $i < $pages; $i++) {
             $start = $i * $params['itemsPerPage'] + 1;
             $resultSet = $this->gaApi->getData($profile->getGoogleId(), $cfg['dimensions'], $cfg['metrics'], $filters, $segment, $dateFrom, $dateTo, 'ga:date', $start, $params['itemsPerPage']);
             $this->getDataManager()->saveToCsv($resultSet, $profile, $csv, true);
         }
     }
     $this->getDataManager()->uploadCsv($csv->getPathname(), $this->getOutputTable($account, $tableName), true);
 }
开发者ID:keboola,项目名称:google-analytics-bundle,代码行数:26,代码来源:Extractor.php

示例11: warning

 public static function warning($message, $context = array())
 {
     $logger = new Logger('api_log');
     $file = static::prepare('warning');
     $logger->pushHandler(new StreamHandler($file, Logger::INFO));
     $logger->warning($message, $context);
 }
开发者ID:noikiy,项目名称:laravel-wechat-bundle,代码行数:7,代码来源:WechatLogger.php

示例12: warning

 public function warning($message, array $args = [], array $context = [])
 {
     if (count($args)) {
         $message = vsprintf($message, $args);
     }
     return parent::warning($message, $context);
 }
开发者ID:acgrid,项目名称:adbot,代码行数:7,代码来源:Logger.php

示例13: testLogNotHandled

 /**
  * @covers Monolog\Logger::addRecord
  */
 public function testLogNotHandled()
 {
     $logger = new Logger(__METHOD__);
     $handler = $this->getMock('Monolog\\Handler\\NullHandler', array('handle'), array(Logger::ERROR));
     $handler->expects($this->never())->method('handle');
     $logger->pushHandler($handler);
     $this->assertFalse($logger->warning('test'));
 }
开发者ID:beyonddoor,项目名称:monolog,代码行数:11,代码来源:LoggerTest.php

示例14: initManager

 public function initManager(\GearmanJob $job)
 {
     $this->job = $job;
     $this->gearmanDto = unserialize($job->workload());
     $this->processManager = ProcessManagerFactory::getProcessManager($this->gearmanDto->getManagerType());
     $this->processManager->setJob($job);
     $this->processManager->setGearmanDto($this->gearmanDto);
     try {
         $this->processManager->manage();
     } catch (\Exception $e) {
         $errorMessage = "Gearman process manager die with exception: " . $e->getMessage() . "| gearmanDto: " . serialize($this->gearmanDto);
         $this->logger->warning($errorMessage);
         $this->processManager->getExecutionDto()->setErrorMessage($errorMessage);
         die;
     }
     return null;
 }
开发者ID:jamset,项目名称:gearman-conveyor,代码行数:17,代码来源:ProcessManagerInitializer.php

示例15: makeAttentionLog

 protected function makeAttentionLog($inspectionMessage)
 {
     if (!$this->allTasksComplete) {
         $this->logger->error("Inspection message: " . $inspectionMessage);
     }
     $this->logger->warning("Executed with Error: " . serialize($this->executedWithError));
     return null;
 }
开发者ID:jamset,项目名称:tasks-inspector,代码行数:8,代码来源:Inspector.php


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