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


PHP LoggerInterface::log方法代碼示例

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


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

示例1: log

 /**
  * @inheritdoc
  */
 public function log($level, $message, array $context = array())
 {
     if ($this->isLevelLessThanMinimum($level)) {
         return;
     }
     $this->logger->log($level, $message, $context);
 }
開發者ID:swisspost-yellowcube,項目名稱:yellowcube-php,代碼行數:10,代碼來源:MinLevelFilterLogger.php

示例2: dump

 /**
  * @param string $langPackDir       language pack dir in temp folder
  * @param string $projectNamespace  e.g. Oro, OroCRM, etc
  * @param string $outputFormat      xml, yml, etc
  * @param string $locale            en, en_US, fr, etc
  */
 public function dump($langPackDir, $projectNamespace, $outputFormat, $locale)
 {
     $this->preloadExistingTranslations($locale);
     foreach ($this->bundles as $bundle) {
         // skip bundles from other projects
         if ($projectNamespace != $this->getBundlePrefix($bundle->getNamespace())) {
             continue;
         }
         $this->logger->log(LogLevel::INFO, '');
         $this->logger->log(LogLevel::INFO, sprintf('Writing files for <info>%s</info>', $bundle->getName()));
         /** @var MessageCatalogue $currentCatalogue */
         $currentCatalogue = $this->getCurrentCatalog($locale, $bundle->getName());
         $extractedCatalogue = $this->extractViewTranslationKeys($locale, $bundle->getPath());
         $operation = new MergeOperation($currentCatalogue, $extractedCatalogue);
         $messageCatalogue = $operation->getResult();
         $isEmptyCatalogue = $this->validateAndFilter($messageCatalogue);
         if (!$isEmptyCatalogue) {
             $translationsDir = $langPackDir . DIRECTORY_SEPARATOR . $bundle->getName() . DIRECTORY_SEPARATOR . 'translations';
             $this->filesystem->mkdir($translationsDir);
             $this->writer->writeTranslations($messageCatalogue, $outputFormat, ['path' => $translationsDir]);
         } else {
             $this->logger->log(LogLevel::INFO, '    - no files generated');
         }
     }
 }
開發者ID:xamin123,項目名稱:platform,代碼行數:31,代碼來源:TranslationPackDumper.php

示例3: log

 /**
  * Write a message to the log or skip over it if the message is null
  *
  * @param string $logLevel
  * @param string|null $message
  */
 protected function log($logLevel, $message)
 {
     if ($message === null) {
         return;
     }
     $this->logger->log($logLevel, $message);
 }
開發者ID:RonRademaker,項目名稱:tactician-logger,代碼行數:13,代碼來源:LoggerMiddleware.php

示例4: __construct

 public function __construct($message = \null, $code = \null, $previous = \null)
 {
     parent::__construct($message, $code, $previous);
     if (static::$logger !== \null) {
         static::$logger->log(LogLevel::ALERT, $message, array('code' => $this->getCode(), 'message' => $this->getMessage(), 'file' => $this->getFile(), 'line' => $this->getLine(), 'type' => 'exceptions'));
     }
 }
開發者ID:control-corp,項目名稱:micro,代碼行數:7,代碼來源:Exception.php

示例5: log

 /**
  * {@inheritdoc}
  */
 public function log($level, $message, array $context = array())
 {
     if ($this->logger) {
         $this->logger->log($level, $message, $context);
     }
     return $this;
 }
開發者ID:phpextra,項目名稱:proxy,代碼行數:10,代碼來源:LoggerProxy.php

示例6: log

 public function log($message, array $context = array(), $level = LogLevel::DEBUG)
 {
     if (!isset($this->logger)) {
         return;
     }
     $this->logger->log($level, $message, $context);
 }
開發者ID:phpguard,項目名稱:listen,代碼行數:7,代碼來源:BaseAdapter.php

示例7: onPreHttpRequestSend

 /**
  * @param \Neoxygen\NeoClient\Event\HttpClientPreSendRequestEvent $event
  */
 public function onPreHttpRequestSend(HttpClientPreSendRequestEvent $event)
 {
     $conn = $event->getRequest()->getConnection();
     $request = $event->getRequest();
     $mode = $request->hasQueryMode() ? $request->getQueryMode() : 'ASSUMED WRITE';
     $this->logger->log('debug', sprintf('Sending "%s" request to the "%s" connection', $mode, $conn));
 }
開發者ID:siddhartham-ysg,項目名稱:neo4j-neoclient,代碼行數:10,代碼來源:HttpRequestEventSubscriber.php

示例8: log

 /**
  * Logs with an arbitrary level.
  *
  * @param  mixed  $level
  * @param  string $message
  * @param  array  $context
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     if (null === $this->logger) {
         return;
     }
     $add = true;
     $stackTrace = $this->getStackTrace();
     if (null !== $this->stopwatch) {
         $trace = debug_backtrace();
         $method = $trace[3]['function'];
         $watch = 'Propel Query ' . (count($this->queries) + 1);
         if ('prepare' === $method) {
             $this->isPrepared = true;
             $this->stopwatch->start($watch, 'propel');
             $add = false;
         } elseif ($this->isPrepared) {
             $this->isPrepared = false;
             $event = $this->stopwatch->stop($watch);
         }
     }
     // $trace[2] has no 'object' key if an exception is thrown while executing a query
     if ($add && isset($event) && isset($trace[2]['object'])) {
         $connection = $trace[2]['object'];
         $this->queries[] = array('sql' => $message, 'connection' => $connection->getName(), 'time' => $event->getDuration() / 1000, 'memory' => $event->getMemory(), 'stackTrace' => $stackTrace);
     }
     $this->logger->log($level, $message, $context);
 }
開發者ID:naldz,項目名稱:cyberden,代碼行數:35,代碼來源:PropelLogger.php

示例9: log

 /**
  * Записывает сообщение в лог.
  * @param string $level уровень критичности сообщения
  * @param string $message сообщение, поддерживает плейсхолдеры в формате {placeholder}
  * @param array $placeholders список плейсхолдеров
  * @return $this
  */
 protected function log($level, $message, array $placeholders = [])
 {
     if ($this->traitLogger) {
         $this->traitLogger->log($level, $message, $placeholders);
     }
     return $this;
 }
開發者ID:umisoft,項目名稱:umi.framework,代碼行數:14,代碼來源:TLoggerAware.php

示例10: log

 /**
  * Adds the message prefix and invokes the logger->log() method.
  *
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return void
  */
 private function log($level, $message, array $context = array())
 {
     // Using a falsy level disables logging
     if ($level) {
         $this->logger->log($level, $this->prefix . $message, $context);
     }
 }
開發者ID:gcrico,項目名稱:swift-mailer-psr-logger-plugin,代碼行數:15,代碼來源:SwiftMailerPsrLoggerPlugin.php

示例11: getForm

 /**
  * {@inheritdoc}
  */
 public function getForm($formClass)
 {
     $args = func_get_args();
     array_shift($args);
     if (!class_exists($formClass)) {
         $this->logger->log(LogLevel::CRITICAL, "Form class '@class' does not exists", ['@class' => $formClass]);
         return [];
     }
     if (!method_exists($formClass, 'create')) {
         $this->logger->log(LogLevel::CRITICAL, "Form class '@class' does not implements ::create()", ['@class' => $formClass]);
         return [];
     }
     // God, I do hate Drupal 8...
     $form = call_user_func([$formClass, 'create'], $this->container);
     if (!$form instanceof FormInterface) {
         $this->logger->log(LogLevel::CRITICAL, "Form class '@class' does not implement \\Drupal\\Core\\Form\\FormInterface", ['@class' => $formClass]);
         return [];
     }
     $formId = $form->getFormId();
     $data = [];
     $data['build_info']['args'] = $args;
     $formState = new FormState($data);
     $formState->setFormObject($form);
     $this->formMap[$formId] = [$form, $formState];
     return drupal_build_form($formId, $data);
 }
開發者ID:makinacorpus,項目名稱:drupal-sf-dic,代碼行數:29,代碼來源:FormBuilder.php

示例12: log

 /**
  * Log payment message, prepending payment bundle name if set.
  *
  * @param string $level         Level
  * @param string $message       Message to log
  * @param string $paymentMethod Payment method
  * @param array  $context       Context
  *
  * @return PaymentLogger Self object
  */
 public function log($level, $message, $paymentMethod, array $context = [])
 {
     if (!$this->active) {
         return $this;
     }
     $this->logger->log($level, "[{$paymentMethod}] - {$message}", $context);
     return $this;
 }
開發者ID:gerfigna,項目名稱:paymentsuite,代碼行數:18,代碼來源:PaymentLogger.php

示例13: handleException

 /**
  * handleException
  *
  * Handles Exceptions
  *
  * @access public
  * @param  Exception $exception
  * @return void
  * @todo   Make default / fallback log level configurable
  **/
 public function handleException(Exception $exception)
 {
     if (method_exists($exception, "getSeverityLevel")) {
         $this->logger->log($exception->getSeverityLevel(), $exception->getMessage(), $this->getExceptionContext($exception));
     } else {
         $this->logger->critical($exception->getMessage(), $this->getExceptionContext($exception));
     }
 }
開發者ID:niels-nijens,項目名稱:failurehandling,代碼行數:18,代碼來源:DefaultFailureHandler.php

示例14: handle

 /**
  * {@inheritDoc}
  */
 public function handle(array $record)
 {
     if (!$this->isHandling($record)) {
         return false;
     }
     $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']);
     return false === $this->bubble;
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:11,代碼來源:PsrHandler.php

示例15: testSendMailToTwoRecipients

 /**
  * Tests sending a mail to two recipients.
  *
  * @covers ::execute
  */
 public function testSendMailToTwoRecipients()
 {
     $to = ['mail@example.com', 'mail2@example.com'];
     $this->action->setContextValue('to', $to)->setContextValue('subject', 'subject')->setContextValue('message', 'hello');
     $params = ['subject' => 'subject', 'message' => 'hello'];
     $this->mailManager->mail('rules', 'rules_action_mail_' . $this->action->getPluginId(), implode(', ', $to), LanguageInterface::LANGCODE_SITE_DEFAULT, $params, NULL)->willReturn(['result' => TRUE])->shouldBeCalledTimes(1);
     $this->logger->log(LogLevel::NOTICE, SafeMarkup::format('Successfully sent email to %to', ['%to' => implode(', ', $to)]))->shouldBeCalledTimes(1);
     $this->action->execute();
 }
開發者ID:shahinam,項目名稱:drupal8devel,代碼行數:14,代碼來源:SystemSendEmailTest.php


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