本文整理汇总了PHP中Monolog\Logger::alert方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::alert方法的具体用法?PHP Logger::alert怎么用?PHP Logger::alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monolog\Logger
的用法示例。
在下文中一共展示了Logger::alert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alert
public function alert($message, array $args = [], array $context = [])
{
if (count($args)) {
$message = vsprintf($message, $args);
}
return parent::alert($message, $context);
}
示例2: sendAttentionMail
public function sendAttentionMail($inspectionMessage)
{
$this->getMailer()->setBody($inspectionMessage . " | " . serialize($this->executedWithError));
$sentResult = $this->getMailer()->send();
$this->logger->alert("Mail from " . $this->getMailer()->getFrom() . " TO: " . serialize($this->getMailer()->getAllRecipientAddresses()) . " with subject " . $this->getMailer()->getSubject() . " contain " . serialize($this->getMailer()->getBody()) . " with result " . serialize($sentResult) . " was sent.");
return null;
}
示例3: refund
public function refund(PayableInterface $payable, $reference)
{
try {
$amount = $this->getAmountBySmallestCurrencyUnit($payable);
return $this->_charge->refund($reference, $amount);
} catch (\Exception $e) {
$this->_logger->alert($e);
throw $e;
}
}
示例4: 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!']);
}
示例5: alert
/**
* Adds a log record at the ALERT 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 alert($message, $context = array())
{
return \Monolog\Logger::alert($message, $context);
}
示例6: testError
public function testError(FailEvent $e)
{
$this->logger->alert($e->getFail()->getMessage());
$this->logger->info("# ERROR #");
}
示例7: alert
/**
* Adds a log record at the ALERT level.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public function alert($message, array $context = array())
{
return $this->_logger->alert($message, $context);
}
示例8: testError
public function testError(\Codeception\Event\Fail $e)
{
$this->logger->alert($e->getFail()->getMessage());
$this->logger->info("# ERROR #");
}
示例9: alert
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $params
* @param array $context
* @return null
*/
public function alert($message, array $params = array(), array $context = array())
{
$logMessage = $this->createMessage($message, $params);
$this->logger->alert($logMessage, $context);
}
示例10: alert
/**
* @inheritdoc
* @return boolean Whether the record has been processed.
*/
public function alert($message, array $context = [])
{
return $this->_monolog->alert($message, $context);
}
示例11: logFinishShutDown
public function logFinishShutDown()
{
$this->logger->alert("Finish shutDown in " . $this->shutDownType . "| PID: " . posix_getpid());
return null;
}
示例12: catch
try {
$ttl = $arguments['ttl'] && is_numeric($arguments['ttl']) ? (int) $arguments['ttl'] : 0;
$deletedJobs = $queue->cleanupTable($ttl);
cli\line("%g{$deletedJobs} jobs tidied up from '{$config['table_name']}'%n");
} catch (Exception $e) {
cli\err("%rUnable to cleanup table: " . $e->getMessage() . "%n");
exit(1);
}
exit(0);
}
//------------------------------------
// Validate the table (and connection)
try {
$valid = $queue->isTableValid();
if (is_array($valid)) {
$logger->alert("Errors were found when validating the table is setup correctly", $valid);
exit(1);
}
} 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);
示例13: testProcessorsNotCalledWhenNotHandled
/**
* @covers Monolog\Logger::addRecord
*/
public function testProcessorsNotCalledWhenNotHandled()
{
$logger = new Logger(__METHOD__);
$handler = $this->getMock('Monolog\\Handler\\HandlerInterface');
$handler->expects($this->once())->method('isHandling')->will($this->returnValue(false));
$logger->pushHandler($handler);
$that = $this;
$logger->pushProcessor(function ($record) use($that) {
$that->fail('The processor should not be called');
});
$logger->alert('test');
}
示例14: alert
/**
* @param string $message
* @param array $context
* @return bool
*/
public function alert($message, array $context = array())
{
return parent::alert($message, $context);
}
示例15: alert
public function alert($msg)
{
$this->logger->alert($msg);
}