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


PHP Logger::addEmergency方法代码示例

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


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

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

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

示例3: setRootUrl

 /**
  * Sets the root URL of the website to scan
  * @param  string    $rootUrl
  * @param  bool      $limitToPath
  * @throws Exception If the root URL is invalid
  */
 private function setRootUrl($rootUrl, $limitToPath = true)
 {
     // If the rootUrl is *, it means that we'll pass in some URLs manually
     if ($rootUrl == '*') {
         $this->rootUrl = $rootUrl;
         return;
     }
     // Make sure the rootUrl is parse-able
     $urlParts = parse_url($rootUrl);
     if (!$urlParts || !isset($urlParts['scheme']) || !isset($urlParts['host'])) {
         $this->logger->addEmergency('Invalid rootUrl!');
         throw new Exception('Invalid rootUrl!');
     }
     // Force trailing / on rootUrl, it's easier for us to work with it
     if (substr($rootUrl, -1) != '/') {
         $rootUrl .= '/';
     }
     // store rootUrl
     $this->rootUrl = strstr($rootUrl, '?') ? substr($rootUrl, 0, strpos($rootUrl, '?')) : $rootUrl;
     // store rootUrl without queryString
     // If we need to limit to the path of the URL (viz. at first run): take that one into account
     // Otherwise keep the already set path
     $this->rootUrlBasePath = $urlParts['scheme'] . '://' . $urlParts['host'] . ($limitToPath ? $urlParts['path'] : $this->rootUrlParts['path']);
     if (!$limitToPath) {
         $this->logger->addNotice('Updated rootUrl to ' . $this->rootUrl);
         $this->logger->addNotice('Updated rootUrlBasePath to ' . $this->rootUrlBasePath);
     }
     // store urlParts
     $this->rootUrlParts = $urlParts;
 }
开发者ID:bramus,项目名称:mixed-content-scan,代码行数:36,代码来源:Scanner.php

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

示例5: it_correctly_identifies_the_info

 /**
  * @test
  */
 public function it_correctly_identifies_the_info()
 {
     $bugsnag = new Bugsnag_Client(self::APIKEY);
     $logger = new Logger('my_logger');
     $logger->pushHandler(new BugsnagHandler(Logger::INFO, true, 'BugsnagMonolog', $bugsnag));
     $logger->addInfo('info', ['some' => 'message']);
     $logger->addError('error', ['some' => 'message']);
     $logger->addAlert('alert', ['some' => 'message']);
     $logger->addCritical('critical', ['some' => 'message']);
     $logger->addDebug('debug', ['some' => 'message']);
     $logger->addWarning('warning', ['some' => 'message']);
     $logger->addEmergency('emergency', ['some' => 'message']);
     $logger->addNotice('notice', ['some' => 'message']);
     $this->assertTrue(true);
 }
开发者ID:zae,项目名称:monolog-bugsnag,代码行数:18,代码来源:BugsnagLoggerTest.php

示例6: addEmergency

 /**
  * Adds a log record at the EMERGENCY level.
  *
  * @param string $message The log message
  * @param array $context The log context
  * @return Boolean Whether the record has been processed
  * @static 
  */
 public static function addEmergency($message, $context = array())
 {
     return \Monolog\Logger::addEmergency($message, $context);
 }
开发者ID:samcrosoft,项目名称:MicroTranslate,代码行数:12,代码来源:lumen_ide_helper.php

示例7: emergency

 public function emergency($message, array $context = array())
 {
     if (isset($this->logger)) {
         $this->logger->addEmergency($message, $context);
     }
 }
开发者ID:byjg,项目名称:cache-engine-php,代码行数:6,代码来源:LogHandler.php

示例8: addEmergency

 /**
  * @param string $message
  * @param array $context
  * @return bool
  */
 public function addEmergency($message, array $context = array())
 {
     return parent::addEmergency($message, $context);
 }
开发者ID:akentner,项目名称:incoming-ftp,代码行数:9,代码来源:LoggerProxy.php

示例9: emergency

 public function emergency($msg)
 {
     $this->logger->addEmergency($msg);
 }
开发者ID:db80,项目名称:ovo-container,代码行数:4,代码来源:MonologAdapter.php

示例10: emergency

 /**
  * @param Logger $logger
  * @param $msg
  * @param array $param
  */
 public function emergency(Logger $logger, $msg, $param = array())
 {
     $logger->addEmergency($msg, $param);
 }
开发者ID:prateek-1708,项目名称:php-mvc-framework,代码行数:9,代码来源:LoggerWrapper.php

示例11: array

$view = $app->view();
$view->parserExtensions = array(new \Slim\Views\TwigExtension());
$redis = new Predis\Client(array("scheme" => "tcp", "host" => "127.0.0.1", "port" => 6379));
$app->get('/hello/:name', function ($name) use($app) {
    $logPath = '/tmp/mono.log';
    $logger = new Logger('foo_test');
    $logger->pushHandler(new StreamHandler($logPath, Logger::DEBUG));
    // $logger->info()
    $logger->addInfo('info_bar');
    // $logger->notice()
    $logger->addNotice('notice_bar');
    // $logger->warning(), $logger->warn()
    $logger->addWarning('warning_bar');
    // $logger->error(), $logger->err()
    $logger->addError('error_bar');
    // $logger->critical(), $logger->crit()
    $logger->addCritical('critical_bar');
    // $logger->alert()
    $logger->addAlert('alert_bar');
    // $logger->emergency(), $logger->emerg()
    $logger->addEmergency('emergency_bar');
    $app->render('index.html', array('name' => $name));
});
$app->get('/redis', function () use($redis) {
    // PING
    echo $redis->ping();
    $redis->set('key', 'value');
    $value = $redis->get('key');
    echo "key: " . $value;
});
$app->run();
开发者ID:kura-lab,项目名称:slim-sample,代码行数:31,代码来源:index.php


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