本文整理汇总了PHP中Monolog\Logger::emergency方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::emergency方法的具体用法?PHP Logger::emergency怎么用?PHP Logger::emergency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monolog\Logger
的用法示例。
在下文中一共展示了Logger::emergency方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emergency
public function emergency($message, array $args = [], array $context = [])
{
if (count($args)) {
$message = vsprintf($message, $args);
}
return parent::emergency($message, $context);
}
示例2: checkIsConfigured
/**
* Проверяет, что сервис был корректно сконфигурирован
*
* @throws ConfigurationErrorException
*/
private function checkIsConfigured()
{
if (!$this->isConfigured()) {
$message = sprintf(self::ERR__NOT_CONFIGURED, get_class($this));
$this->logger->emergency($message);
throw new ConfigurationErrorException($message);
}
}
示例3: testPushErrors
/**
*
*/
public function testPushErrors()
{
$redis = \Mockery::mock('Predis\\Client')->shouldReceive('publish')->times(8)->with('log', \Mockery::any())->mock();
$monolog = new Logger('test');
$monolog->pushHandler(new PublishHandler(new RedisPublisher($redis)));
$monolog->debug('the message was: {message}', ['DEBUG!']);
$monolog->info('the message was: {message}', ['INFO!']);
$monolog->notice('the message was: {message}', ['NOTICE!']);
$monolog->warning('the message was: {message}', ['WARNING!']);
$monolog->error('the message was: {message}', ['ERROR!']);
$monolog->critical('the message was: {message}', ['CRITICAL!']);
$monolog->alert('the message was: {message}', ['ALERT!']);
$monolog->emergency('the message was: {message}', ['EMERGENCY!']);
}
示例4: write
/**
* {@inheritdoc}
*/
public function write($exception, $logType)
{
foreach ($this->rules as $rule => $condition) {
switch ($rule) {
case '!instanceof':
if ($exception instanceof $condition) {
return;
}
break;
case 'instanceof':
if (!$exception instanceof $condition) {
return;
}
break;
}
}
$context = is_callable($this->context) ? call_user_func($this->context, $exception) : null;
if ($context === null) {
$context = array('file' => $exception->getFile(), 'line' => $exception->getLine(), 'trace' => $exception->getTrace(), 'logType' => $logType);
}
$this->logger->emergency($exception->getMessage(), $context);
}
示例5: emergency
/**
* 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 emergency($message, $context = array())
{
return \Monolog\Logger::emergency($message, $context);
}
示例6: emergency
/**
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
*/
public function emergency($message, array $context = array())
{
$this->logger->emergency($message, $context);
}
示例7: emergency
/**
* System is unusable.
*
* @param string $message
* @param array $params
* @param array $context
* @return null
*/
public function emergency($message, array $params = array(), array $context = array())
{
$logMessage = $this->createMessage($message, $params);
$this->logger->emergency($logMessage, $context);
}
示例8: emergency
/**
* @inheritdoc
* @return boolean Whether the record has been processed.
*/
public function emergency($message, array $context = [])
{
return $this->_monolog->emergency($message, $context);
}
示例9: catch
} catch (Exception $e) {
$logger->alert("Unable to connect to DynamoDB (and validate the table)", ['exception' => $e]);
exit(1);
}
//------------------------------------
// Create the process handler
#TODO - This will become a config option so custom Handlers can be used.
$handler = new \DynamoQueue\Worker\Handler\Autoloader();
//------------------------------------
// Create the (a) Worker
$worker = new \DynamoQueue\Worker\Worker($queue, $handler, $logger);
//---
declare (ticks=1);
pcntl_signal(SIGTERM, array($worker, 'stop'));
pcntl_signal(SIGINT, array($worker, 'stop'));
pcntl_signal(SIGQUIT, array($worker, 'stop'));
//---
try {
$logger->notice("Worker started");
$okay = $worker->run();
} catch (Exception $e) {
$logger->emergency("An unknown exception has caused the queue to terminate", ['exception' => $e]);
exit(1);
}
//---
$logger->notice("Worker stopped");
if ($okay) {
exit(0);
} else {
exit(1);
}
示例10: write
/**
* {@inheritdoc}
*/
public function write(\Exception $exception, $logType)
{
$this->logger->emergency($exception->getMessage(), array('exception' => $exception->getTrace(), 'logType' => $logType));
}
示例11: emergency
/**
* @param string $message
* @param array $context
* @return bool
*/
public function emergency($message, array $context = array())
{
return parent::emergency($message, $context);
}
示例12: MonologHandler
<?php
include 'basics.php';
use unreal4u\MonologHandler;
use unreal4u\TgLog;
use Monolog\Logger;
#$monologTgLogger = new MonologHandler(new TelegramLog(BOT_TOKEN), A_USER_CHAT_ID, Logger::DEBUG); // Sends from DEBUG+
$monologTgLogger = new MonologHandler(new TgLog(BOT_TOKEN), A_USER_CHAT_ID, Logger::ERROR);
// Sends ERROR+
//Create logger
$logger = new Logger('TelegramLogger');
$logger->pushHandler($monologTgLogger);
//Now you can use the logger, and further attach additional information
$logger->debug('Nobody gives a dime for debug messages', ['moreInfo' => 'Within here']);
$logger->info('A user has logged in');
$logger->notice('Something unusual has happened!', ['it did indeed']);
$logger->warning('Somebody should attend this', ['some', 'extra' => 'information']);
$logger->error('Something really bad happened');
$logger->critical('A critical message', ['please' => 'Check this out']);
$logger->alert('This is an alert', ['oh no...' => 'This might be urgent']);
$logger->emergency('Run for your lives!', ['this is it' => 'everything has stopped working']);