本文整理汇总了PHP中Psr\Log\LoggerInterface::emergency方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerInterface::emergency方法的具体用法?PHP LoggerInterface::emergency怎么用?PHP LoggerInterface::emergency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Log\LoggerInterface
的用法示例。
在下文中一共展示了LoggerInterface::emergency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* {@inheritdoc}
*/
public function log($message, $level)
{
$message .= ' ' . $this->request->getRequestUri();
if ($this->logLevel >= $level) {
switch ($level) {
case self::EMERGENCY:
$this->logger->emergency($message);
break;
case self::ALERT:
$this->logger->alert($message);
break;
case self::CRITICAL:
$this->logger->critical($message);
break;
case self::ERROR:
$this->logger->error($message);
break;
case self::WARNING:
$this->logger->warning($message);
break;
case self::NOTICE:
$this->logger->notice($message);
break;
case self::INFO:
$this->logger->info($message);
break;
default:
$this->logger->debug($message);
}
}
}
示例2: emergency
/**
* System is unusable.
*
* @param string $message
* @param array $context
* @return bool
*/
public function emergency($message, array $context = array())
{
if (self::isSetLogger()) {
return self::$logger->emergency($message, $context);
}
return false;
}
示例3: emergency
/**
* {@inheritdoc}
*/
public function emergency($message, array $context = array())
{
if (!$this->logger) {
return;
}
return $this->logger->emergency($message, $context);
}
示例4: emergency
/**
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
*/
public function emergency($message, array $context = array())
{
if ($this->logger) {
$context = $this->getLoggerContext($context);
$this->logger->emergency($message, $context);
}
}
示例5: shutdown
/**
* Uncatchable error handler
*/
public function shutdown()
{
$error = error_get_last();
if ($error !== NULL && $error["type"] !== E_CORE_WARNING && $error["type"] !== E_WARNING && $error["type"] !== E_USER_WARNING && $error["type"] !== E_NOTICE && $error["type"] !== E_USER_NOTICE) {
if (null !== $this->logger) {
$this->logger->emergency($error["message"] . ' in ' . $error["file"] . ' on line ' . $error["line"]);
}
}
}
示例6: execute
/**
* @param ContextInterface $context
*
* @return void
*/
public function execute(ContextInterface $context)
{
if ($context instanceof ProfileContext) {
$this->doExecute($context);
} else {
$message = sprintf('Expected ProfileContext but got %s', get_class($context));
$this->logger->emergency($message, array('context' => $context));
throw new LightSamlContextException($context, $message);
}
}
示例7: doLog
/**
* Logs a message.
*
* @param string $message Message
* @param string $priority Message priority
*
* @return void
*/
public function doLog($message, $priority)
{
if (!$this->logger) {
$this->buffer[] = compact('message', 'priority');
return;
}
switch ($priority) {
case sfLogger::EMERG:
$this->logger->emergency($message);
break;
case sfLogger::ALERT:
$this->logger->alert($message);
break;
case sfLogger::CRIT:
$this->logger->critical($message);
break;
case sfLogger::ERR:
$this->logger->error($message);
break;
case sfLogger::WARNING:
$this->logger->warning($message);
break;
case sfLogger::NOTICE:
$this->logger->notice($message);
break;
case sfLogger::INFO:
$this->logger->info($message);
break;
case sfLogger::DEBUG:
$this->logger->debug($message);
break;
}
}
示例8: emergency
/**
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
*/
public function emergency($message, array $context = array())
{
if (empty($this->logger)) {
return;
}
$this->logger->emergency($this->getDefaultMessage() . $message, $context);
}
示例9: emergency
/**
* @param mixed $message
* @param array $context
* @return self
*/
public function emergency($message, array $context = []) : self
{
if (!$this->logger) {
return $this;
}
$this->logger->emergency($message, $context);
return $this;
}
示例10: handleJobs
/**
*
*/
private function handleJobs()
{
// Handle jobs
$this->out('Handling Jobs.');
try {
$this->manager->start();
} catch (\Exception $e) {
$this->logger->emergency("Highly unexpected exception while running Manager->start(), investigation needed.", ['message' => $e->getMessage(), 'trace' => $e->getTraceAsString()]);
}
}
示例11: tick
public function tick()
{
if (null === $this->pdo) {
$this->logger->warning('Unable to ping sql server, service pdo is unavailable');
return;
}
//if connection is persistent we don't need to ping
if (true === $this->pdo->getAttribute(\PDO::ATTR_PERSISTENT)) {
return;
}
try {
$startTime = microtime(true);
$this->pdo->query('SELECT 1');
$endTime = microtime(true);
$this->logger->notice(sprintf('Successfully ping sql server (~%s ms)', round(($endTime - $startTime) * 100000), 2));
} catch (\PDOException $e) {
$this->logger->emergency('Sql server is gone, and unable to reconnect');
throw $e;
}
}
示例12: __construct
public function __construct(UrlBuilder $u, LoggerInterface $logger)
{
$pages = array();
// Disable `HTML` extension of CssSelector.
CssSelector::disableHtmlExtension();
$client = new Client();
$crawler = $client->request('GET', (string) $u);
$status = $client->getResponse()->getStatus();
if ($status > 399) {
$logger->emergency('Status ' . $status . ' getting ' . (string) $u);
}
$sitemap_crawler = $crawler->filter('urlset > url > loc');
foreach ($sitemap_crawler as $url_loc) {
$url = $url_loc->nodeValue;
$pages[$url] = $url;
}
parent::__construct($pages);
}
示例13: shipmentTrackingSave
public function shipmentTrackingSave(\Praxigento\Odoo\Api\Data\SaleOrder\Shipment\Tracking $data)
{
$result = false;
/* replicate all data in one transaction */
$def = $this->_manTrans->begin();
try {
$orderIdMage = $data->getSaleOrderIdMage();
$trackNumber = $data->getData('shipment/trackingInfo/trackingNumber');
$shippingMethodCode = $data->getData('shipment/trackingInfo/shippingCode');
$this->_shipmentLoader->setOrderId($orderIdMage);
/** @var \Magento\Sales\Model\Order\Shipment $shipment */
$shipment = $this->_shipmentLoader->load();
if ($shipment) {
$carrierCode = $this->_manBusCodes->getMagCodeForCarrier($shippingMethodCode);
$title = $this->_manBusCodes->getTitleForCarrier($shippingMethodCode);
$track = $this->_manObj->create(\Magento\Sales\Model\Order\Shipment\Track::class);
$track->setNumber($trackNumber);
$track->setCarrierCode($carrierCode);
$track->setTitle($title);
$shipment->addTrack($track);
$shipment->register();
$shipment->save();
$order = $shipment->getOrder();
$invoice = $this->_manInvoice->prepareInvoice($order);
$invoice->register();
$invoice->save();
$order->save();
$this->_manTrans->commit($def);
$result = true;
}
} catch (\Exception $e) {
$msg = 'Product replication from Odoo is failed. Error: ' . $e->getMessage();
$this->_logger->emergency($msg);
$traceStr = $e->getTraceAsString();
$this->_logger->emergency($traceStr);
throw $e;
} finally {
// transaction will be rolled back if commit is not done (otherwise - do nothing)
$this->_manTrans->end($def);
}
return $result;
}
示例14: productsFromOdoo
public function productsFromOdoo(Request\ProductsFromOdoo $req)
{
$result = new Response\ProductsFromOdoo();
/* replicate all data in one transaction */
$def = $this->_manTrans->begin();
try {
$ids = $req->getOdooIds();
/** @var $inventory Inventory */
$inventory = $this->_repoOdooInventory->get($ids);
$this->_doProductReplication($inventory);
$this->_manTrans->commit($def);
$result->markSucceed();
} catch (\Exception $e) {
$msg = 'Product replication from Odoo is failed. Error: ' . $e->getMessage();
$this->_logger->emergency($msg);
$traceStr = $e->getTraceAsString();
$this->_logger->emergency($traceStr);
throw $e;
} finally {
// transaction will be rolled back if commit is not done (otherwise - do nothing)
$this->_manTrans->end($def);
}
return $result;
}
示例15: emergency
public function emergency($message, array $context = [])
{
$this->logger->emergency($message, $this->enrichContext($context));
}