當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。