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


PHP Logger::addWarning方法代码示例

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


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

示例1: writeEntry

 protected function writeEntry($level, $message, $indent, $category = "", $additionalData = [])
 {
     $message = str_pad($category, 16, " ", STR_PAD_RIGHT) . "\t" . str_repeat("  ", $indent) . $message;
     switch ($level) {
         case Log::BULK_DATA_LEVEL:
             $this->logger->addDebug($message, $additionalData);
             break;
         case Log::DEBUG_LEVEL:
             $this->logger->addDebug($message, $additionalData);
             break;
         case Log::ERROR_LEVEL:
             $this->logger->addError($message, $additionalData);
             break;
         case Log::PERFORMANCE_LEVEL:
             $this->logger->addNotice($message, $additionalData);
             break;
         case Log::WARNING_LEVEL:
             $this->logger->addWarning($message, $additionalData);
             break;
         case Log::REPOSITORY_LEVEL:
             $this->logger->addNotice($message, $additionalData);
             break;
         default:
             $this->logger->addNotice($message, $additionalData);
     }
 }
开发者ID:rhubarbphp,项目名称:rhubarb,代码行数:26,代码来源:MonologLog.php

示例2: _call

 /**
  * @param string $token Access token from the calling client
  *
  * @return string|false The result from the cURL call against the oauth API.
  *
  * @codeCoverageIgnore This function is not tested because we can't test
  *                     curl_* calls in PHPUnit.
  */
 protected function _call($token)
 {
     $ch = curl_init();
     $url = $this->_apiUrl . $token;
     $this->_logger->addDebug('calling GET: ' . $url);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
     $result = curl_exec($ch);
     $responseCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
     $curlErrno = curl_errno($ch);
     $curlError = curl_error($ch);
     // remove token from url for log output
     $url = substr($url, 0, stripos($url, 'token') + 6);
     if (0 !== $curlErrno) {
         $this->_logger->addError('curl error (' . $curlErrno . '): ' . $curlError . ' url: ' . $url);
     }
     if ($responseCode >= 500) {
         $this->_logger->addError('curl call error: ' . $responseCode . ' url: ' . $url);
     } elseif ($responseCode >= 300) {
         $this->_logger->addWarning('curl call warning: ' . $responseCode . ' url: ' . $url);
     }
     $this->_logger->addDebug('result: (' . $responseCode . ') ' . var_export($result, true));
     curl_close($ch);
     return $result;
 }
开发者ID:bigpoint,项目名称:slim-bootstrap,代码行数:34,代码来源:Oauth.php

示例3: log

 public function log($message, $priority = self::INFO)
 {
     if ($message instanceof \Exception) {
         $message = $message->getMessage();
         $context = [];
     } elseif (is_string($message)) {
         $context = [];
     } else {
         $context = $message;
         unset($context[0]);
         unset($context[1]);
         if (isset($message[1])) {
             $message = preg_replace('#\\s*\\r?\\n\\s*#', ' ', trim($message[1]));
         }
     }
     switch ($priority) {
         case self::DEBUG:
             return $this->monolog->addDebug($message, $context);
         case self::CRITICAL:
             return $this->monolog->addCritical($message, $context);
         case self::ERROR:
             return $this->monolog->addError($message, $context);
         case self::EXCEPTION:
             return $this->monolog->addEmergency($message, $context);
         case self::WARNING:
             return $this->monolog->addWarning($message, $context);
         case 'access':
             return $this->monolog->addNotice($message, $context);
         case 'emergency':
             return $this->monolog->addEmergency($message, $context);
         default:
             return $this->monolog->addInfo($message, $context);
     }
 }
开发者ID:bazo,项目名称:nette-monolog-extension,代码行数:34,代码来源:MonologAdapter.php

示例4: write

 /**
  * Uses the Monolog file Logger to write a log message in a file.
  *
  * @param  string   $message  Message that needs to be output
  * @param  bool  $error    If the log message is considered an error, for logging purposes
  */
 public function write($message, $error = false)
 {
     if (!$error) {
         $this->logger->addWarning($message);
         return;
     }
     $this->logger->addError($message);
 }
开发者ID:anekdotes,项目名称:logger,代码行数:14,代码来源:FileDriver.php

示例5: addModule

 /**
  * Add Module
  * @param string $moduleName
  * @param array  $args
  */
 public function addModule($moduleName, $args = [])
 {
     try {
         $module = $this->moduleFactory->build($moduleName, PHP_OS, $args);
         $this->moduleComposite->addComponent($module);
     } catch (ModuleException $e) {
         $this->logger->addWarning($e->getMessage());
     }
 }
开发者ID:phaniso,项目名称:phpmonitor-api,代码行数:14,代码来源:Facade.php

示例6: getAll

 /**
  * @param string|null $type
  * @return array
  */
 public function getAll($type = null)
 {
     $type = strtolower($type);
     if (!empty($this->config[$type])) {
         return $this->config[$type];
     }
     $this->logger->addWarning('Config group not found: [' . $type . ']');
     return array();
 }
开发者ID:sovereignbot,项目名称:citadel,代码行数:13,代码来源:Config.php

示例7: send

 /**
  * Send the email
  *
  * @return void
  */
 public function send()
 {
     if ($this->enabled) {
         if (!$this->emailer->send()) {
             $this->logger->addWarning($this->emailer->error());
         }
     } else {
         $this->logger->addWarning('Faked sending an email ' . $this->emailer->get('body'));
     }
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:15,代码来源:Mailer.php

示例8: getSortingParametersFromArray

 /**
  * @param array $inputArray
  * @param string[] $columNamesInDatabase
  * @return null|string[]
  */
 public function getSortingParametersFromArray($inputArray, $columNamesInDatabase, $defaultSearch = array())
 {
     if (array_key_exists('iSortingCols', $inputArray)) {
         if ($inputArray['iSortingCols'] > count($columNamesInDatabase)) {
             $this->logger->addWarning("did have enough columNames for " . $inputArray['iSortingCols'] . " sort columns.");
             return null;
         }
         return $this->getSortingParametersFromArrayImpl($inputArray, $columNamesInDatabase, $defaultSearch);
     } else {
         $this->logger->addWarning("did not find iSortingCols in inputArray");
         return null;
     }
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:18,代码来源:DataTablesUtility.php

示例9: log

 /**
  * Log a message
  *
  * @param string $message
  * @param int    $level
  * @param array $context
  * @return void
  */
 public function log($message, $level = Logger::INFO, array $context = [])
 {
     if (!$this->logger) {
         return;
     }
     if (null === $level) {
         $level = Logger::INFO;
     }
     switch ($level) {
         case Logger::DEBUG:
             $this->logger->addDebug($message, $context);
             break;
         case Logger::INFO:
             $this->logger->addInfo($message, $context);
             break;
         case Logger::NOTICE:
             $this->logger->addNotice($message, $context);
             break;
         case Logger::WARNING:
             $this->logger->addWarning($message, $context);
             break;
         case Logger::ERROR:
             $this->logger->addError($message, $context);
             break;
         case Logger::CRITICAL:
             $this->logger->addCritical($message, $context);
             break;
         case Logger::EMERGENCY:
             $this->logger->addEmergency($message, $context);
             break;
         default:
             break;
     }
 }
开发者ID:dwsla,项目名称:service-mpx,代码行数:42,代码来源:AbstractService.php

示例10: log

 /**
  * Отправляет сообщение в лог
  *
  * @param string $message сообщение
  * @param int    $level   уровень
  *
  * @return void
  */
 public function log($message, $level = AbstractLogger::NOTICE)
 {
     if ($level < $this->severity) {
         return;
     }
     switch ($level) {
         case AbstractLogger::EMERGENCY:
             $this->impl->addEmergency($message);
             break;
         case AbstractLogger::ALERT:
             $this->impl->addAlert($message);
             break;
         case AbstractLogger::CRITICAL:
             $this->impl->addCritical($message);
             break;
         case AbstractLogger::ERROR:
             $this->impl->addError($message);
             break;
         case AbstractLogger::WARNING:
             $this->impl->addWarning($message);
             break;
         case AbstractLogger::NOTICE:
             $this->impl->addNotice($message);
             break;
         case AbstractLogger::INFO:
             $this->impl->addInfo($message);
             break;
         case AbstractLogger::DEBUG:
             $this->impl->addDebug($message);
             break;
     }
 }
开发者ID:itmh,项目名称:service-tools-old,代码行数:40,代码来源:MonologLogger.php

示例11: putIndex

 /**
  * Update an existing user
  *
  * @param int $id
  * @param HttpFoundation\Request $request
  * @return HttpFoundation\JsonResponse|HttpFoundation\Response
  */
 public function putIndex($id, HttpFoundation\Request $request)
 {
     $this->log->addDebug(print_r($request, true), ['namespace' => 'HackTheDinos\\Controllers\\User', 'method' => 'putIndex', 'type' => 'request']);
     //If this request validated then the userId should be in the request.
     $userId = $request->request->get('userId');
     if ($userId === $id) {
         $user = $this->repo->getById($userId);
         $this->log->addDebug(print_r($user, true), ['namespace' => 'HackTheDinos\\Controllers\\User', 'method' => 'putIndex', 'type' => 'user']);
         //It's almost impossible for this to happen but it's good defensive coding.
         if (!empty($user)) {
             $user = $this->converter->entityArrayToModel(json_decode($request->getContent(), true), new Models\User());
             $user->id = $userId;
             if (isset($user->password)) {
                 $user->password = password_hash($user->password, PASSWORD_DEFAULT);
             }
             if ($this->repo->save($user)) {
                 $this->log->addInfo('Updated user', ['namespace' => 'HackTheDinos\\Controllers\\User', 'method' => 'putIndex', 'user' => (array) $user]);
                 return new HttpFoundation\JsonResponse($user, 200);
             }
             //Otherwise we couldn't save the user for some reason
             $this->log->addWarning('Unable to update user', ['namespace' => 'HackTheDinos\\Controllers\\User', 'method' => 'putIndex', 'request' => $request->getContent(), 'user' => (array) $user]);
             return new HttpFoundation\Response('Bad Request', 400);
         }
     }
     //We didn't find a user to update.
     $this->log->addWarning('No user found', ['namespace' => 'HackTheDinos\\Controllers\\User', 'method' => 'putIndex', 'id' => $id, 'userId' => $userId]);
     return new HttpFoundation\Response('Not Found', 404);
 }
开发者ID:HackTheDinos,项目名称:tinder-for-fossils-backend,代码行数:35,代码来源:Users.php

示例12: compareColumns

 /**
  * @param array $fromCols
  * @param array $toCols
  * @throws StructureException
  * @throws \Exception
  */
 public function compareColumns($fromCols, $toCols)
 {
     $columnClass = new \ReflectionClass('rombar\\PgExplorerBundle\\Models\\dbElements\\Column');
     if (count($fromCols) == 0 || count($toCols) == 0) {
         throw new \Exception('A table has no columns!');
     }
     $ignoredMethods = ['getTable', 'getRealPosition', 'getOid'];
     list($namesFrom, $namesTo) = $this->compareColumnsNames($fromCols, $toCols);
     foreach ($namesFrom as $fromKey => $fromColName) {
         $fromCol = $fromCols[$fromKey];
         $toCol = $toCols[array_search($fromColName, $namesTo)];
         foreach ($columnClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
             if (preg_match('#^get#', $method->name) && !in_array($method->name, $ignoredMethods)) {
                 $getter = $method->name;
                 if ($fromCol->{$getter}() != $toCol->{$getter}()) {
                     //Special hook for nextval.
                     // With certain search path, the schema can be omitted wich make a false positive.
                     if ($getter == 'getDefault' && preg_match('/^nextval/', $fromCol->{$getter}())) {
                         $diff = str_replace('.', '', Utils::stringDiff($fromCol->{$getter}(), $toCol->{$getter}()));
                         $this->logger->addDebug('diff search_path : ' . $diff);
                         if (in_array($diff, $this->toAnalyzer->getSearchPath()) || in_array($diff, $this->fromAnalyzer->getSearchPath())) {
                             $this->logger->addWarning('Bypass by search_path test for ' . $getter . ' : ' . $fromCol->{$getter}() . ' vs ' . $toCol->{$getter}());
                             continue;
                         }
                     }
                     $this->logger->addWarning('Column ' . $fromColName . '->' . $getter . '() : ' . $fromCol->{$getter}() . ' vs ' . $toCol->{$getter}());
                     var_dump($fromCol);
                     var_dump($toCol);
                     throw new StructureException('Targeted database has a different column ' . $fromCol->getName() . ' in table ' . $fromCol->getSchema() . PgAnalyzer::DB_SEPARATOR . $this->fromAnalyzer->getTable($fromCol->getSchema(), $fromCol->getTable())->getName() . ' check the property ' . substr($getter, 3));
                 }
             }
         }
     }
 }
开发者ID:rombar3,项目名称:PgExplorer,代码行数:40,代码来源:CompareStructure.php

示例13: findTextByKey

 protected function findTextByKey($steps, $count)
 {
     $node = $this->source;
     foreach (explode('.', $steps) as $step) {
         if (!isset($node[$step])) {
             $this->log->addWarning("Translation for '{$steps}' not found, missing key '{$step}'", [$this->language]);
             return NULL;
         }
         $node = $node[$step];
     }
     if (!is_array($node)) {
         if ($count !== NULL) {
             $this->log->addNotice("Translation for '{$steps}' has no plurals, but count '{$count}' was passed", [$this->language]);
         }
         return $node;
     }
     if ($count === NULL) {
         $this->log->addNotice("Translation for '{$steps}' has plurals, but no count was passed", [$this->language]);
     }
     $keys = $this->countToKey($count);
     foreach ($keys as $key) {
         if (isset($node[$key])) {
             return $node[$key];
         }
     }
     $this->log->addWarning("Translation for '{$steps}' is missing plurals", [$this->language]);
     return NULL;
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:28,代码来源:Translator.php

示例14: startWorker

 /**
  * Start the worker.
  */
 public function startWorker()
 {
     $this->pheanstalk->watch($this->queue);
     $this->pheanstalk->ignore('default');
     $buildStore = Factory::getStore('Build');
     while ($this->run) {
         // Get a job from the queue:
         $job = $this->pheanstalk->reserve();
         $this->checkJobLimit();
         // Get the job data and run the job:
         $jobData = json_decode($job->getData(), true);
         if (!$this->verifyJob($job, $jobData)) {
             continue;
         }
         $this->logger->addInfo('Received build #' . $jobData['build_id'] . ' from Beanstalkd');
         // If the job comes with config data, reset our config and database connections
         // and then make sure we kill the worker afterwards:
         if (!empty($jobData['config'])) {
             $this->logger->addDebug('Using job-specific config.');
             $currentConfig = Config::getInstance()->getArray();
             $config = new Config($jobData['config']);
             Database::reset($config);
         }
         try {
             $build = BuildFactory::getBuildById($jobData['build_id']);
         } catch (\Exception $ex) {
             $this->logger->addWarning('Build #' . $jobData['build_id'] . ' does not exist in the database.');
             $this->pheanstalk->delete($job);
         }
         try {
             // Logging relevant to this build should be stored
             // against the build itself.
             $buildDbLog = new BuildDBLogHandler($build, Logger::INFO);
             $this->logger->pushHandler($buildDbLog);
             $builder = new Builder($build, $this->logger);
             $builder->execute();
             // After execution we no longer want to record the information
             // back to this specific build so the handler should be removed.
             $this->logger->popHandler($buildDbLog);
         } catch (\PDOException $ex) {
             // If we've caught a PDO Exception, it is probably not the fault of the build, but of a failed
             // connection or similar. Release the job and kill the worker.
             $this->run = false;
             $this->pheanstalk->release($job);
         } catch (\Exception $ex) {
             $build->setStatus(Build::STATUS_FAILED);
             $build->setFinished(new \DateTime());
             $build->setLog($build->getLog() . PHP_EOL . PHP_EOL . $ex->getMessage());
             $buildStore->save($build);
             $build->sendStatusPostback();
         }
         // Reset the config back to how it was prior to running this job:
         if (!empty($currentConfig)) {
             $config = new Config($currentConfig);
             Database::reset($config);
         }
         // Delete the job when we're done:
         $this->pheanstalk->delete($job);
     }
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:63,代码来源:BuildWorker.php

示例15: index

 public function index()
 {
     $this->load->view('welcome_message');
     $log = new Logger('test001');
     $log->pushHandler(new StreamHandler('/tmp/my.log', Logger::WARNING));
     $log->addWarning('Foo');
     $log->addError('Bar');
 }
开发者ID:ashiina,项目名称:ci3-tdd-stack,代码行数:8,代码来源:Libtest.php


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