本文整理汇总了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);
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例7: emergency
public function emergency($message, array $context = array())
{
if (isset($this->logger)) {
$this->logger->addEmergency($message, $context);
}
}
示例8: addEmergency
/**
* @param string $message
* @param array $context
* @return bool
*/
public function addEmergency($message, array $context = array())
{
return parent::addEmergency($message, $context);
}
示例9: emergency
public function emergency($msg)
{
$this->logger->addEmergency($msg);
}
示例10: emergency
/**
* @param Logger $logger
* @param $msg
* @param array $param
*/
public function emergency(Logger $logger, $msg, $param = array())
{
$logger->addEmergency($msg, $param);
}
示例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();