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


PHP LoggerInterface::alert方法代碼示例

本文整理匯總了PHP中Psr\Log\LoggerInterface::alert方法的典型用法代碼示例。如果您正苦於以下問題:PHP LoggerInterface::alert方法的具體用法?PHP LoggerInterface::alert怎麽用?PHP LoggerInterface::alert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Psr\Log\LoggerInterface的用法示例。


在下文中一共展示了LoggerInterface::alert方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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 $context
  * @return null
  */
 public function alert($message, array $context = array())
 {
     if ($this->logger) {
         $context = $this->getLoggerContext($context);
         $this->logger->alert($message, $context);
     }
 }
開發者ID:aurimasniekis,項目名稱:epwt-traits,代碼行數:17,代碼來源:LoggerAwareTrait.php

示例2: onShutdown

 /**
  * When the process is shutdown we will check for errors.
  */
 public function onShutdown()
 {
     $error = error_get_last();
     if (!empty($error) && isset($error['type']) && error_reporting()) {
         $this->logger->alert($error['message'], ['error' => new Error($error['message'], $error['line'], $error['file'])]);
     }
 }
開發者ID:Pageon,項目名稱:pageon-fork-config,代碼行數:10,代碼來源:Handler.php

示例3: 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 $context
  * @return bool
  */
 public function alert($message, array $context = array())
 {
     if (self::isSetLogger()) {
         return self::$logger->alert($message, $context);
     }
     return false;
 }
開發者ID:chenwenzhang,項目名稱:initially-rpc,代碼行數:17,代碼來源:LoggerProxy.php

示例4: setWorkingDirectory

 /**
  * @param string $path the working directory for filesystem operations
  *
  * @throws \InvalidArgumentException
  * @throws IOException
  */
 public function setWorkingDirectory($path)
 {
     $directory = preg_replace('#/+#', '/', $path);
     // remove multiple slashes
     try {
         $directory = $this->locator->locate($directory);
         if (false === is_string($directory)) {
             $directory = strval(reset($directory));
             $this->logger->alert(sprintf('Ambiguous filename %s, choosing %s', $path, $directory));
         }
     } catch (\InvalidArgumentException $exception) {
         // continue to check if dir exists even if locator doesn't locate
     }
     $exists = $this->filesystem->exists($directory);
     if (!$exists) {
         try {
             $this->filesystem->mkdir($directory);
             $this->logger->notice("Working directory created at " . $directory);
         } catch (IOException $exception) {
             $this->logger->error("An error occurred while creating directory at " . $exception->getPath(), $exception->getTrace());
             throw $exception;
         }
     }
     $this->directory = $directory;
 }
開發者ID:florianajir,項目名稱:datanova-bundle,代碼行數:31,代碼來源:Finder.php

示例5: 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

示例6: send

 /**
  * @param RequestableInterface $apiRequest
  *
  * @return bool|\GuzzleHttp\Message\ResponseInterface
  */
 public function send(RequestableInterface $apiRequest)
 {
     $request = $this->guzzleClient->createRequest($apiRequest->getMethod(), $apiRequest->getUrl(), $apiRequest->getOptions());
     try {
         return $this->guzzleClient->send($request);
     } catch (ClientException $e) {
         if (null !== $this->logger) {
             $this->logger->alert($e->getMessage());
         }
         return false;
     }
 }
開發者ID:puterakahfi,項目名稱:certificationy-web-platform,代碼行數:17,代碼來源:Client.php

示例7: signalHandler

 /**
  * @param  int $signal
  * @return void
  */
 public function signalHandler($signal)
 {
     switch ($signal) {
         case SIGINT:
         case SIGTERM:
             $this->logger->alert('Worker killed or terminated', array('sessionId', $this->sessionId));
             $this->daemonizable->shutdown();
             exit(1);
             break;
         case SIGHUP:
             $this->logger->info('Starting daemon', array('session' => $this->sessionId));
             break;
     }
 }
開發者ID:evaneos,項目名稱:burrow,代碼行數:18,代碼來源:Worker.php

示例8: 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

示例9: handleWebHookAction

 /**
  * @param Request $request
  *
  * @Rest\View(statusCode=204)
  * @Rest\Post("/webhook", defaults={"_format": "json"})
  *
  * @throws ResourceConflictException
  * @throws \Exception
  * @return null
  */
 public function handleWebHookAction(Request $request)
 {
     $this->logger->info($request->getContent());
     try {
         $event = null;
         $store = $this->storeService->getStoreByRequest($request);
         $eventId = $this->shopifyEventRetriever->verifyWebhookRequest($request, $store);
         $event = $this->shopifyEventRetriever->retrieve($eventId);
         if ($event) {
             throw new EventAlreadyProcessed(sprintf('Event Id %s has already been processed', $eventId));
         }
         //Save the event so we don't process this again
         $event = Event::createFromRequest($request, $eventId);
         $this->eventRepository->save($event);
         $cmd = $this->commandFactory->create($event, $store);
         $handler = $this->handlerFactory->create($event);
         $handler->execute($cmd);
         $event->updateStatus(Event::STATUS_PROCESSED);
         $this->logger->alert(sprintf('Completed Processing event id %s', $eventId));
     } catch (\Exception $e) {
         if ($event instanceof Event) {
             $event->updateStatus(Event::STATUS_FAILED);
         }
         $this->logger->alert($e->getMessage());
     } finally {
         if ($event instanceof Event) {
             $this->eventRepository->update($event);
         }
         return new Response('', 201);
     }
 }
開發者ID:XBS-Nathan,項目名稱:erp_to_shopify,代碼行數:41,代碼來源:WebHookController.php

示例10: generateMenu

 /**
  * @param ItemInterface $menu
  * @param AdminMenu[] $tree
  * @param int $level
  */
 protected function generateMenu(&$menu, &$tree, $level = 0)
 {
     while (!empty($tree)) {
         $item = array_shift($tree);
         $type = $item->getType();
         $itemLabel = $item->getTitle();
         $itemLevel = $item->getLevel();
         if ($itemLevel == $level) {
             $options = [];
             if (AdminMenu::TYPE_FOLDER !== $type) {
                 $admin = $this->pool->getInstance($item->getServiceId());
                 if ($admin) {
                     $options = $admin->generateMenuUrl('list');
                     $options['extras'] = ['admin' => $admin];
                 } else {
                     $this->logger->alert('Admin not found for class', [$item->getServiceId()]);
                 }
             }
             $child = $menu->addChild($itemLabel, $options);
         } elseif ($itemLevel > $level) {
             array_unshift($tree, $item);
             $this->generateMenu($child, $tree, $itemLevel);
         } else {
             array_unshift($tree, $item);
             break;
         }
     }
 }
開發者ID:octava,項目名稱:cms,代碼行數:33,代碼來源:Builder.php

示例11: getHandlers

 /**
  * @param MessageInterface $message
  * @return MessageHandlerInterface[]
  * @throws EventBusException
  */
 public function getHandlers(MessageInterface $message)
 {
     $handlers = [];
     $eventName = $message->getName();
     if (!array_key_exists($eventName, $this->map)) {
         return $handlers;
     }
     foreach ($this->map[$eventName] as $handlerName) {
         try {
             $handlers[] = $this->locator->get($handlerName);
         } catch (\Exception $e) {
             $this->logger->alert($e->getMessage(), ['exception' => $e]);
         }
     }
     return $handlers;
 }
開發者ID:averor,項目名稱:cqrs,代碼行數:21,代碼來源:EventHandlerLocator.php

示例12: addSignals

 private function addSignals()
 {
     \Amp\onSignal(SIGINT, function () {
         exit;
     });
     \Amp\onSignal(SIGTERM, function () {
         exit;
     });
     register_shutdown_function(function () {
         $this->logger->alert('Clean exit. Thank you.');
         if (\Amp\info()["state"] !== \Amp\Reactor::STOPPED) {
             \Amp\stop();
         }
     });
     return true;
 }
開發者ID:skedone,項目名稱:DaemonsBundle,代碼行數:16,代碼來源:DaemonizeEventListener.php

示例13: alert

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

示例14: 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 $context
  * @return null
  */
 public function alert($message, array $context = array())
 {
     if (empty($this->logger)) {
         return;
     }
     $this->logger->alert($this->getDefaultMessage() . $message, $context);
 }
開發者ID:sphring,項目名稱:sphring,代碼行數:17,代碼來源:LoggerSphring.php

示例15: setValue

 private function setValue(&$item, $key, $value, $options = [])
 {
     try {
         $this->debug && $this->logger->info("Value adding is started.");
         switch ($options['type']) {
             case "string":
             case "text":
             case "integer":
             case "collection":
             case "bool":
                 if (isset($options['modifier'])) {
                     $value = $this->modify($value, $options['modifier'], $item);
                 }
                 break;
             case "date":
                 if (isset($options['modifier'])) {
                     $value = $this->modify($value, $options['modifier'], $item);
                 } else {
                     $value = $this->modifyDate($value, $options);
                 }
                 break;
             case "object":
                 $value = $this->setObjectValue($item, $key, $value, $options);
                 break;
         }
         if (array_key_exists('value', $options)) {
             $value = $options['value'];
         }
         $value ? $this->accessor->setValue($item, $key, $value) : $this->logger->alert("Value is null for {$key}.");
         $this->debug && $this->logger->info("Value adding is completed.");
     } catch (\Exception $e) {
         $this->logger->critical($e->getMessage());
     }
 }
開發者ID:hmert,項目名稱:importbundle,代碼行數:34,代碼來源:ImportManager.php


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