当前位置: 首页>>代码示例>>PHP>>正文


PHP LoggerInterface::notice方法代码示例

本文整理汇总了PHP中Psr\Log\LoggerInterface::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerInterface::notice方法的具体用法?PHP LoggerInterface::notice怎么用?PHP LoggerInterface::notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Psr\Log\LoggerInterface的用法示例。


在下文中一共展示了LoggerInterface::notice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: error

 /**
  * Error handler
  *
  * @param $errno
  * @param $errstr
  * @param $errfile
  * @param $errline
  */
 public function error($errno, $errstr, $errfile, $errline)
 {
     $message = $errstr . ' in ' . $errfile . ' on line ' . $errline;
     if (null !== $this->logger) {
         switch ($errno) {
             case E_CORE_ERROR:
             case E_COMPILE_ERROR:
             case E_COMPILE_WARNING:
                 $this->logger->emergency($message);
                 break;
             case E_ERROR:
             case E_USER_ERROR:
             case E_PARSE:
             case E_RECOVERABLE_ERROR:
                 $this->logger->error($message);
                 break;
             case E_WARNING:
             case E_USER_WARNING:
                 $this->logger->warning($message);
                 break;
             case E_NOTICE:
             case E_USER_NOTICE:
                 $this->logger->notice($message);
                 break;
             case E_DEPRECATED:
             case E_USER_DEPRECATED:
             case E_STRICT:
                 $this->logger->notice($message);
                 break;
             default:
                 $this->logger->error("Unknown error type: " . $errno . ": " . $message);
                 break;
         }
     }
 }
开发者ID:sinergi,项目名称:core,代码行数:43,代码来源:ErrorHandler.php

示例2: logState

 /**
  * Log the state of the analysis.
  *
  * @param \StyleCI\StyleCI\Models\Analysis
  *
  * @return void
  */
 protected function logState(Analysis $analysis)
 {
     switch ($analysis->status) {
         case Analysis::PENDING:
             $this->logger->debug('Analysis has been queued.', $this->getContext($analysis));
             break;
         case Analysis::RUNNING:
             $this->logger->debug('Analysis has started running.', $this->getContext($analysis));
             break;
         case Analysis::PASSED:
         case Analysis::CS_ISSUES:
         case Analysis::SYNTAX_ISSUES:
         case Analysis::BOTH_ISSUES:
             $this->logger->debug('Analysis has completed successfully.', $this->getContext($analysis));
             break;
         case Analysis::CONFIG_ISSUES:
             $this->logger->notice('Analysis has failed due to misconfiguration.', $this->getContext($analysis));
             break;
         case Analysis::ACCESS_ISSUES:
             $this->logger->warning('Analysis has failed due to git access issues.', $this->getContext($analysis));
             break;
         case Analysis::TIMEOUT:
             $this->logger->error('Analysis has failed due to a platform timeout.', $this->getContext($analysis));
             break;
         default:
             $this->logger->error('Analysis has failed due to an internal error.', $this->getContext($analysis));
     }
 }
开发者ID:tangtienviet,项目名称:StyleCI,代码行数:35,代码来源:AnalysisLoggingHandler.php

示例3: switchLocaleAction

 public function switchLocaleAction(Request $request)
 {
     $this->guard->userIsLoggedIn();
     $this->logger->notice('User requested to switch locale');
     $returnUrl = $request->query->get('return-url');
     // Return URLs generated by us always include a path (ie. at least a forward slash)
     // @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878
     $domain = $request->getSchemeAndHttpHost() . '/';
     if (strpos($returnUrl, $domain) !== 0) {
         $this->logger->error(sprintf('Illegal return-url ("%s") for redirection after changing locale, aborting request', $returnUrl));
         throw new BadRequestHttpException('Invalid return-url given');
     }
     $command = new ChangeLocaleCommand();
     $form = $this->formFactory->create('profile_switch_locale', $command, [])->handleRequest($request);
     $this->logger->notice(sprintf('Switching locale from "%s" to "%s"', $request->getLocale(), $command->newLocale));
     if ($form->isValid()) {
         $this->userService->changeLocale($command);
         $this->flashBag->add('success', 'profile.locale.locale_change_success');
         $this->logger->notice(sprintf('Successfully switched locale from "%s" to "%s"', $request->getLocale(), $command->newLocale));
     } else {
         $this->flashBag->add('error', 'profile.locale.locale_change_fail');
         $this->logger->error('Locale not switched: the switch locale form contained invalid data');
     }
     return new RedirectResponse($returnUrl);
 }
开发者ID:OpenConext,项目名称:OpenConext-profile,代码行数:25,代码来源:LocaleController.php

示例4: onKernelException

 /**
  * @param GetResponseForExceptionEvent $event
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     $logRef = uniqid();
     $exception = $event->getException();
     if ($exception instanceof NotFoundHttpException) {
         $event->setResponse(new VndErrorResponse("Not found", Response::HTTP_NOT_FOUND));
         return;
     }
     if ($exception instanceof AuthenticationException) {
         $event->setResponse(new VndErrorResponse("Unauthorized", Response::HTTP_UNAUTHORIZED));
         return;
     }
     new VndErrorResponse("Authentication Failure", Response::HTTP_UNAUTHORIZED);
     $code = $exception->getCode();
     if (strlen($code) !== 3) {
         $this->fallback($message, $code, $logRef, $exception);
     } else {
         switch (substr($code, 0, 1)) {
             case '4':
                 $message = 'Input Error';
                 $this->logger->notice("Input error [logref {$logRef}]: " . $exception->__toString());
                 break;
             case '5':
                 $message = 'Server Error';
                 $this->logger->error("Runtime error [logref {$logRef}]: " . $exception->__toString());
                 break;
             default:
                 $this->fallback($message, $code, $logRef, $exception);
         }
     }
     $event->setResponse(new VndErrorResponse($message, $code, $logRef));
 }
开发者ID:krizon,项目名称:swagger-bundle,代码行数:35,代码来源:ExceptionListener.php

示例5: verifyYubikeyPublicId

 /**
  * @param VerifyYubikeyPublicIdCommand $command
  * @return VerificationResult
  */
 public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command)
 {
     $verifyOtpCommand = new VerifyYubikeyOtpCommand();
     $verifyOtpCommand->otp = $command->otp;
     $verifyOtpCommand->identityId = $command->identityId;
     $verifyOtpCommand->institution = $command->institution;
     $verificationResult = $this->yubikeyService->verify($verifyOtpCommand);
     if (YubikeyOtp::isValid($command->otp)) {
         $otp = YubikeyOtp::fromString($command->otp);
         $publicId = YubikeyPublicId::fromOtp($otp);
     } else {
         $publicId = null;
     }
     if ($verificationResult->isServerError()) {
         return new VerificationResult(VerificationResult::RESULT_OTP_VERIFICATION_FAILED, $publicId);
     } elseif ($verificationResult->isClientError()) {
         return new VerificationResult(VerificationResult::RESULT_OTP_INVALID, $publicId);
     }
     if ($publicId->getYubikeyPublicId() !== $command->expectedPublicId) {
         $this->logger->notice('Yubikey used by registrant during vetting did not match the one used during registration.');
         return new VerificationResult(VerificationResult::RESULT_PUBLIC_ID_DID_NOT_MATCH, $publicId);
     }
     $this->logger->info('Yubikey used by registrant during vetting matches the one used during registration.');
     return new VerificationResult(VerificationResult::RESULT_PUBLIC_ID_MATCHED, $publicId);
 }
开发者ID:eefjevanderharst,项目名称:Stepup-RA,代码行数:29,代码来源:YubikeySecondFactorService.php

示例6: fetchGitTemplate

 private function fetchGitTemplate($gitUrl)
 {
     $this->logger->notice('Fetching template from {url}', ['url' => $gitUrl]);
     $directory = $this->createTempDirectory('couscous_template_');
     $this->git->cloneRepository($gitUrl, $directory);
     return $directory;
 }
开发者ID:snipe,项目名称:Couscous,代码行数:7,代码来源:FetchRemoteTemplate.php

示例7: handle

 /**
  * {@inheritdoc}
  */
 public function handle(ServerRequestInterface $request, $exception)
 {
     if ($exception instanceof HttpException) {
         if ($this->logger) {
             $this->logger->notice($this->prettifyRequest($request));
             $this->logger->notice($exception);
         }
         return $exception;
     }
     if ($this->config->get('debug', true)) {
         $whoops = $this->getWhoops($request);
         return create($whoops->handleException($exception), 500);
     }
     $statusCode = 500;
     $reasonPhrase = 'Internal Server Error';
     if ($exception instanceof RouteNotFoundException) {
         $statusCode = 404;
         $reasonPhrase = "Not Found";
     } elseif ($exception instanceof RouteMethodException) {
         $statusCode = 405;
         $reasonPhrase = 'Method Not Allowed';
     }
     if ($this->logger) {
         $this->logger->error($this->prettifyRequest($request));
         $this->logger->error($exception);
     }
     if ($this->isAjax($request)) {
         return json(['status' => $statusCode, 'reason' => $reasonPhrase], $statusCode);
     }
     return create("{$statusCode} {$reasonPhrase}", $statusCode);
 }
开发者ID:wandu,项目名称:framework,代码行数:34,代码来源:DefaultHttpErrorHandler.php

示例8: overviewAction

 /**
  * @return Response
  */
 public function overviewAction()
 {
     $this->guard->userIsLoggedIn();
     $this->logger->notice('Showing My Profile page');
     $user = $this->userService->getUser();
     return new Response($this->templateEngine->render('OpenConextProfileBundle:MyProfile:overview.html.twig', ['user' => $user]));
 }
开发者ID:OpenConext,项目名称:OpenConext-profile,代码行数:10,代码来源:MyProfileController.php

示例9: setDeployment

 /**
  * Performs the request to make the deployment
  *
  * @param string $description
  * @param bool $change
  * @param bool $user
  *
  * @return bool|string
  */
 public function setDeployment($description, $change = false, $user = false)
 {
     $apiUrl = $this->config->getNewRelicApiUrl();
     if (empty($apiUrl)) {
         $this->logger->notice('New Relic API URL is blank, using fallback URL');
         $apiUrl = self::API_URL;
     }
     /** @var \Magento\Framework\HTTP\ZendClient $client */
     $client = $this->clientFactory->create();
     $client->setUri($apiUrl);
     $client->setMethod(ZendClient::POST);
     $client->setHeaders(['x-api-key' => $this->config->getNewRelicApiKey()]);
     $params = ['deployment[app_name]' => $this->config->getNewRelicAppName(), 'deployment[application_id]' => $this->config->getNewRelicAppId(), 'deployment[description]' => $description, 'deployment[changelog]' => $change, 'deployment[user]' => $user];
     $client->setParameterPost($params);
     try {
         $response = $client->request();
     } catch (\Zend_Http_Client_Exception $e) {
         $this->logger->critical($e);
         return false;
     }
     if ($response->getStatus() < 200 || $response->getStatus() > 210) {
         $this->logger->warning('Deployment marker request did not send a 200 status code.');
         return false;
     }
     return $response->getBody();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:35,代码来源:Deployments.php

示例10: handleErrorException

 /**
  * @param \ErrorException $exception
  *
  * @return bool
  */
 protected function handleErrorException(\ErrorException $exception)
 {
     switch ($exception->getSeverity()) {
         case E_ERROR:
         case E_RECOVERABLE_ERROR:
         case E_CORE_ERROR:
         case E_COMPILE_ERROR:
         case E_USER_ERROR:
         case E_PARSE:
             $this->logger->error($this->buildLogMessage($exception));
             break;
         case E_WARNING:
         case E_USER_WARNING:
         case E_CORE_WARNING:
         case E_COMPILE_WARNING:
             $this->logger->warning($this->buildLogMessage($exception));
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
             $this->logger->notice($this->buildLogMessage($exception));
             break;
         case E_STRICT:
         case E_DEPRECATED:
         case E_USER_DEPRECATED:
             $this->logger->info($this->buildLogMessage($exception));
             break;
     }
     return true;
 }
开发者ID:phprest,项目名称:phprest,代码行数:34,代码来源:Log.php

示例11: loadEntityConfigs

 /**
  * @param ClassMetadataInfo $metadata
  * @param bool              $force
  */
 protected function loadEntityConfigs(ClassMetadataInfo $metadata, $force)
 {
     if ($this->hasEntityConfigs($metadata)) {
         $className = $metadata->getName();
         if ($this->configManager->hasConfig($className)) {
             $this->logger->notice(sprintf('Update config for "%s" entity.', $className));
             $this->configManager->updateConfigEntityModel($className, $force);
         } else {
             $this->logger->notice(sprintf('Create config for "%s" entity.', $className));
             $this->configManager->createConfigEntityModel($className);
         }
         $fieldNames = $metadata->getFieldNames();
         foreach ($fieldNames as $fieldName) {
             if ($this->hasFieldConfigs($metadata, $fieldName)) {
                 $fieldType = $metadata->getTypeOfField($fieldName);
                 $this->loadFieldConfigs($className, $fieldName, $fieldType, $force);
             }
         }
         $associationNames = $metadata->getAssociationNames();
         foreach ($associationNames as $associationName) {
             if ($this->hasAssociationConfigs($metadata, $associationName)) {
                 $associationType = $metadata->isSingleValuedAssociation($associationName) ? 'ref-one' : 'ref-many';
                 $this->loadFieldConfigs($className, $associationName, $associationType, $force);
             }
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:31,代码来源:ConfigLoader.php

示例12: generate

 /**
  * @param LoggerInterface $logger
  * @param null            $outputDir
  */
 public function generate(LoggerInterface $logger, $outputDir = null)
 {
     $logger->notice('Generate started');
     if (!is_null($outputDir)) {
         $logger->notice('Cleaning dir.');
         $outputDir = realpath($outputDir) . '/';
         foreach (glob($outputDir . '*') as $file) {
             unlink($file);
         }
     }
     foreach ($this->handlers as $handler) {
         $handlerName = basename(str_replace(['\\', 'Handler'], '/', get_class($handler)));
         $logger->notice(sprintf('Generating %s', $handlerName));
         foreach ($handler->getRecords() as $record) {
             $config = $handler->buildConfig($record);
             if (is_null($outputDir)) {
                 echo $config->prettyPrint(-1);
             } else {
                 $fileName = $handlerName . '-' . $this->createFilename($record);
                 $this->write($fileName, $config, $outputDir);
                 $logger->debug(sprintf('%s as %s', $record->getNode()->getTitle(), $fileName));
             }
         }
     }
     $logger->notice('Generate ended');
 }
开发者ID:NoUseFreak,项目名称:clastic-proxy,代码行数:30,代码来源:Generator.php

示例13: addDomainJob

 /**
  * Method to run a domain job whose workload is a serialized JobRequestInterface
  *
  * @param \GearmanJob $job Object with job parameters
  *
  * @throws \Ice\Domain\Jobs\UnsupportedJobException
  * @throws \Exception re-throw uncaught exceptions
  * @return boolean
  *
  * @Gearman\Job(
  *     iterations = 1,
  *     name = "addDomainJob",
  *     description = "Data should be an json-encoded object containing at least a 'name' property. That domain job wll be executed"
  * )
  */
 public function addDomainJob($job)
 {
     $jobRequest = $this->requestSerializer->deserializeJobRequest($job->workload());
     if ($this->logger) {
         $this->logger->notice("Job received", [$job->workload()]);
     }
     if (!$this->director->hasWorkerProviderFor($jobRequest->getName())) {
         if ($this->logger) {
             $this->logger->critical("No worker available for job of name: " . $jobRequest->getName(), [$job->workload()]);
         }
         throw new UnsupportedJobException("No worker available for job of name: " . $jobRequest->getName());
     }
     $worker = $this->director->getWorkerProviderFor($jobRequest->getName())->getWorkerFor($jobRequest->getName());
     try {
         if ($this->eventDispatcher) {
             $this->eventDispatcher->dispatch('ice.job.pre_execute');
         }
         $worker->execute($jobRequest);
         if ($this->logger) {
             $this->logger->notice("Job complete", [$job->workload()]);
         }
     } catch (\Exception $e) {
         if ($this->logger) {
             $this->logger->critical("Uncaught exception when processing job", array('workload' => $job->workload(), 'message' => $e->getMessage(), 'stack_trace' => $e->getTrace(), 'exception' => $e));
         }
         //Re-throw the exception anyway, so that gearman knows the job has failed.
         throw $e;
     }
     return true;
 }
开发者ID:cambridgeuniversity,项目名称:ice-job-bundle,代码行数:45,代码来源:Worker.php

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

示例15: convert

 /**
  * Converts internal links (ezcontent:// and ezlocation://) to URLs.
  *
  * @param \DOMDocument $document
  *
  * @return \DOMDocument
  */
 public function convert(DOMDocument $document)
 {
     $document = clone $document;
     $xpath = new DOMXPath($document);
     $xpath->registerNamespace("docbook", "http://docbook.org/ns/docbook");
     $linkAttributeExpression = "starts-with( @xlink:href, 'ezlocation://' ) or starts-with( @xlink:href, 'ezcontent://' )";
     $xpathExpression = "//docbook:link[{$linkAttributeExpression}]|//docbook:ezlink";
     /** @var \DOMElement $link */
     foreach ($xpath->query($xpathExpression) as $link) {
         // Set resolved href to number character as a default if it can't be resolved
         $hrefResolved = "#";
         $href = $link->getAttribute("xlink:href");
         $location = null;
         preg_match("~^(.+://)?([^#]*)?(#.*|\\s*)?\$~", $href, $matches);
         list(, $scheme, $id, $fragment) = $matches;
         if ($scheme === "ezcontent://") {
             try {
                 $contentInfo = $this->contentService->loadContentInfo($id);
                 $location = $this->locationService->loadLocation($contentInfo->mainLocationId);
                 $hrefResolved = $this->urlAliasRouter->generate($location) . $fragment;
             } catch (APINotFoundException $e) {
                 if ($this->logger) {
                     $this->logger->warning("While generating links for richtext, could not locate " . "Content object with ID " . $id);
                 }
             } catch (APIUnauthorizedException $e) {
                 if ($this->logger) {
                     $this->logger->notice("While generating links for richtext, unauthorized to load " . "Content object with ID " . $id);
                 }
             }
         } else {
             if ($scheme === "ezlocation://") {
                 try {
                     $location = $this->locationService->loadLocation($id);
                     $hrefResolved = $this->urlAliasRouter->generate($location) . $fragment;
                 } catch (APINotFoundException $e) {
                     if ($this->logger) {
                         $this->logger->warning("While generating links for richtext, could not locate " . "Location with ID " . $id);
                     }
                 } catch (APIUnauthorizedException $e) {
                     if ($this->logger) {
                         $this->logger->notice("While generating links for richtext, unauthorized to load " . "Location with ID " . $id);
                     }
                 }
             } else {
                 $hrefResolved = $href;
             }
         }
         $hrefAttributeName = "xlink:href";
         // For embeds set the resolved href to the separate attribute
         // Original href needs to be preserved in order to generate link parameters
         // This will need to change with introduction of UrlService and removal of URL link
         // resolving in external storage
         if ($link->localName === "ezlink") {
             $hrefAttributeName = "href_resolved";
         }
         $link->setAttribute($hrefAttributeName, $hrefResolved);
     }
     return $document;
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:66,代码来源:Link.php


注:本文中的Psr\Log\LoggerInterface::notice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。