當前位置: 首頁>>代碼示例>>PHP>>正文


PHP LoggerInterface::emergency方法代碼示例

本文整理匯總了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);
         }
     }
 }
開發者ID:dragonsword007008,項目名稱:magento2,代碼行數:34,代碼來源:Logger.php

示例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;
 }
開發者ID:chenwenzhang,項目名稱:initially-rpc,代碼行數:14,代碼來源:LoggerProxy.php

示例3: emergency

 /**
  * {@inheritdoc}
  */
 public function emergency($message, array $context = array())
 {
     if (!$this->logger) {
         return;
     }
     return $this->logger->emergency($message, $context);
 }
開發者ID:gbprod,項目名稱:elastica-bundle,代碼行數:10,代碼來源:ElasticaLogger.php

示例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);
     }
 }
開發者ID:aurimasniekis,項目名稱:epwt-traits,代碼行數:14,代碼來源:LoggerAwareTrait.php

示例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"]);
         }
     }
 }
開發者ID:sinergi,項目名稱:core,代碼行數:12,代碼來源:ErrorHandler.php

示例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);
     }
 }
開發者ID:lightsaml,項目名稱:lightsaml,代碼行數:15,代碼來源:AbstractProfileAction.php

示例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;
     }
 }
開發者ID:Phennim,項目名稱:symfony1,代碼行數:41,代碼來源:sfPsrLoggerAdapter.class.php

示例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);
 }
開發者ID:sphring,項目名稱:sphring,代碼行數:14,代碼來源:LoggerSphring.php

示例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;
 }
開發者ID:sgc-fireball,項目名稱:libphp,代碼行數:13,代碼來源:Daemon.php

示例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()]);
     }
 }
開發者ID:unifact,項目名稱:connector,代碼行數:13,代碼來源:RunCommand.php

示例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;
     }
 }
開發者ID:rsrodrig,項目名稱:MeetMeSoftware,代碼行數:20,代碼來源:PdoPeriodicPing.php

示例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);
 }
開發者ID:paul-m,項目名稱:sitemap_verify,代碼行數:18,代碼來源:SitemapCrawler.php

示例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;
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_odoo,代碼行數:42,代碼來源:SaleOrderReplicator.php

示例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;
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_odoo,代碼行數:24,代碼來源:Call.php

示例15: emergency

 public function emergency($message, array $context = [])
 {
     $this->logger->emergency($message, $this->enrichContext($context));
 }
開發者ID:eefjevanderharst,項目名稱:Stepup-RA,代碼行數:4,代碼來源:ProcedureAwareLogger.php


注:本文中的Psr\Log\LoggerInterface::emergency方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。