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


PHP LoggerInterface::info方法代码示例

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


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

示例1: __invoke

 public function __invoke(Request $req, Response $res, callable $next)
 {
     $res = $next($req, $res);
     $identity = $this->authService->getIdentity();
     if (!$identity) {
         return $res;
     }
     try {
         $user = R::findOne('user', 'mail = ?', [$identity->mail]);
         if (!$user) {
             $user = R::dispense('user');
             $user->uid = $identity->uid;
             $user->mail = $identity->mail;
             $user->display_name = $identity->displayName;
             $user->office_name = $identity->officeName;
             $user->authentication_source = $identity->authenticationSource;
             $user->password = '';
             $user->created = time();
             $user->role = 'school';
             $this->logger->info(sprintf('User %s imported from sso.sch.gr to database', $identity->mail));
         }
         $user->last_login = time();
         $user_id = R::store($user);
         $identityClass = get_class($identity);
         $newIdentity = new $identityClass($user_id, $user->uid, $user->mail, $user->display_name, $user->office_name, $user->authentication_source);
         $this->authService->getStorage()->write($newIdentity);
     } catch (\Exception $e) {
         $this->authService->clearIdentity();
         $this->flash->addMessage('danger', 'A problem occured storing user in database. <a href="%s" title="SSO logout">SSO Logout</a>');
         $this->logger->error('Problem inserting user form CAS in database', $identity->toArray());
         $this->logger->debug('Exception', [$e->getMessage(), $e->getTraceAsString()]);
         return $res->withRedirect($this->userErrorRedirectUrl);
     }
     return $res;
 }
开发者ID:eellak,项目名称:gredu_labs,代码行数:35,代码来源:CreateUser.php

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->getEntity()->delete();
     $this->logger->info('Payment status %label (@id) has been deleted.', ['@id' => $this->getEntity()->id(), '%label' => $this->getEntity()->label()]);
     drupal_set_message($this->t('%label has been deleted.', array('%label' => $this->getEntity()->label())));
     $form_state->setRedirectUrl($this->getEntity()->urlInfo('collection'));
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentStatusDeleteForm.php

示例3: requestPage

 /**
  * Request the page from IMDb
  * @param $url
  * @return string Page html. Empty string on failure
  * @throws Exception\Http
  */
 protected function requestPage($url)
 {
     $this->logger->info("[Page] Requesting [{$url}]");
     $req = $this->buildRequest($url);
     if (!$req->sendRequest()) {
         $this->logger->error("[Page] Failed to connect to server when requesting url [{$url}]");
         if ($this->config->throwHttpExceptions) {
             throw new Exception\Http("Failed to connect to server when requesting url [{$url}]");
         } else {
             return '';
         }
     }
     if (200 == $req->getStatus()) {
         return $req->getResponseBody();
     } elseif ($redirectUrl = $req->getRedirect()) {
         $this->logger->debug("[Page] Following redirect from [{$url}] to [{$redirectUrl}]");
         return $this->requestPage($redirectUrl);
     } else {
         $this->logger->error("[Page] Failed to retrieve url [{url}]. Response headers:{headers}", array('url' => $url, 'headers' => $req->getLastResponseHeaders()));
         if ($this->config->throwHttpExceptions) {
             $exception = new Exception\Http("Failed to retrieve url [{$url}]. Status code [{$req->getStatus()}]");
             $exception->HTTPStatusCode = $req->getStatus();
             throw new $exception();
         } else {
             return '';
         }
     }
 }
开发者ID:tboothman,项目名称:imdbphp,代码行数:34,代码来源:Pages.php

示例4: processGroup

 /**
  * Process a single group.
  *
  * Without queuedjobs, it's necessary to shell this out to a background task as this is
  * very memory intensive.
  *
  * The sub-process will then invoke $processor->runGroup() in {@see Solr_Reindex::doReindex}
  *
  * @param LoggerInterface $logger
  * @param SolrIndex $indexInstance Index instance
  * @param array $state Variant state
  * @param string $class Class to index
  * @param int $groups Total groups
  * @param int $group Index of group to process
  * @param string $taskName Name of task script to run
  */
 protected function processGroup(LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $groups, $group, $taskName)
 {
     // Build state
     $statevar = json_encode($state);
     if (strpos(PHP_OS, "WIN") !== false) {
         $statevar = '"' . str_replace('"', '\\"', $statevar) . '"';
     } else {
         $statevar = "'" . $statevar . "'";
     }
     // Build script
     $indexName = $indexInstance->getIndexName();
     $scriptPath = sprintf("%s%sframework%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR);
     $scriptTask = "php {$scriptPath} dev/tasks/{$taskName}";
     $cmd = "{$scriptTask} index={$indexName} class={$class} group={$group} groups={$groups} variantstate={$statevar}";
     $cmd .= " verbose=1 2>&1";
     $logger->info("Running '{$cmd}'");
     // Execute script via shell
     $res = $logger ? passthru($cmd) : `{$cmd}`;
     if ($logger) {
         $logger->info(preg_replace('/\\r\\n|\\n/', '$0  ', $res));
     }
     // If we're in dev mode, commit more often for fun and profit
     if (Director::isDev()) {
         Solr::service($indexName)->commit();
     }
     // This will slow down things a tiny bit, but it is done so that we don't timeout to the database during a reindex
     DB::query('SELECT 1');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-fulltextsearch,代码行数:44,代码来源:SolrReindexImmediateHandler.php

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

示例6: execute

 /**
  * Execute the next task on the queue
  *
  * @param string $queue
  * @param int $timeout
  * @throws \Exception
  * @throws \mcfedr\Queue\JobManagerBundle\Exception\UnrecoverableException
  * @throws \mcfedr\Queue\JobManagerBundle\Exception\ExecuteException
  */
 public function execute($queue = null, $timeout = null)
 {
     $job = $this->manager->get($queue, $timeout);
     if (!$job) {
         return;
     }
     $task = json_decode($job->getData(), true);
     $this->logger->info('Got task', ['task' => $task['name'], 'options' => $task['options']]);
     try {
         /** @var Worker $worker */
         $worker = $this->container->get($task['name']);
         foreach ($this->preListeners as $listener) {
             $listener->preTask($worker, $task['options']);
         }
         $worker->execute($task['options']);
         foreach ($this->postListeners as $listener) {
             $listener->postTask($worker, $task['options']);
         }
         $this->manager->delete($job);
     } catch (ServiceNotFoundException $e) {
         $this->manager->delete($job);
         $throw = new UnrecoverableException("Service for job not found", 0, $e);
         $throw->setJob($job);
         throw $throw;
     } catch (UnrecoverableException $e) {
         $this->manager->delete($job);
         $e->setJob($job);
         throw $e;
     } catch (\Exception $e) {
         throw new ExecuteException($job, $e);
     }
 }
开发者ID:mcfedr,项目名称:job-manager-bundle,代码行数:41,代码来源:WorkerManager.php

示例7: createView

 /**
  * Create an express view from the given XML view, will utilize the cache directory
  * to dump and load a template compiled into plain PHP code.
  * 
  * @param ExpressViewRenderer $renderer
  * @param string $resource The resource to be compiled into a view.
  * @return string The fully-qualified name of the compiled view.
  * 
  * @throws \RuntimeException When the given resource could not be found.
  */
 public function createView(ExpressViewRenderer $renderer, $resource)
 {
     $resource = (string) $resource;
     if (!is_file($resource)) {
         throw new \RuntimeException(sprintf('Express view not found: "%s"', $resource));
     }
     $key = $this->createKey($resource);
     $typeName = $this->createTypeName($resource);
     if (class_exists($typeName, false)) {
         return $typeName;
     }
     $file = $this->cachePath . '/' . $key . '.php';
     if (!is_file($file) || filemtime($file) < filemtime($resource)) {
         $time = microtime(true);
         try {
             $code = $this->parseView($renderer, file_get_contents($resource), $resource)->generateCode($key);
         } catch (\Exception $e) {
             throw new \RuntimeException(sprintf('Unable to parse express view "%s"', $resource), 0, $e);
         }
         Filesystem::writeFile($file, $code);
         $diff = sprintf('%.2f', microtime(true) - $time);
         if ($this->logger) {
             $this->logger->info('Compiled express view {view}, time spent {time} seconds', ['view' => $resource, 'time' => $diff]);
         }
     }
     require_once $file;
     if (!class_exists($typeName, false)) {
         throw new \RuntimeException(sprintf('Unable to load compiled express view "%s"', $resource));
     }
     return $typeName;
 }
开发者ID:koolkode,项目名称:view-express,代码行数:41,代码来源:ExpressViewFactory.php

示例8: _getDependedCalcForExistingPeriod

 /**
  * Create new depended period and calculation or return existing data.
  *
  * This function is created for CRAP reducing and is used from this class only.
  *
  * @param \Praxigento\BonusBase\Service\Period\Response\GetForDependentCalc $result
  * @param string $baseCalcTypeCode
  * @param string $baseDsBegin
  * @param string $baseDsEnd
  * @param string $dependentCalcTypeCode
  * @param int $dependentCalcTypeId
  * @param string $dependentDsBegin
  * @param string $dependentDsEnd
  */
 public function _getDependedCalcForExistingPeriod(\Praxigento\BonusBase\Service\Period\Response\GetForDependentCalc $result, $baseCalcTypeCode, $baseDsBegin, $baseDsEnd, $dependentCalcTypeCode, $dependentCalcTypeId, $dependentDsBegin, $dependentDsEnd)
 {
     if ($dependentDsBegin == $baseDsBegin && $dependentDsEnd == $baseDsEnd) {
         /* dependent period has the same begin/end as related base period, get calc data */
         $this->_logger->info("There is base '{$baseCalcTypeCode}' period for dependent '{$dependentCalcTypeCode}' period ({$dependentDsBegin}-{$dependentDsEnd}).");
         $this->_analyzeDependedCalc($result, $dependentCalcTypeCode, $dependentCalcTypeId, $dependentDsBegin, $dependentDsEnd);
     } else {
         /* dependent period has different begin/end than related base period */
         $this->_logger->warning("There is no period for '{$dependentCalcTypeCode}' calculation based on '{$baseCalcTypeCode}' ({$baseDsBegin}-{$baseDsEnd}). New period and related calculation will be created.");
         /* create new depended period & calc */
         $period = new EPeriod();
         $period->setCalcTypeId($dependentCalcTypeId);
         $period->setDstampBegin($baseDsBegin);
         $period->setDstampEnd($baseDsEnd);
         $periodId = $this->_repoPeriod->create($period);
         $period->setId($periodId);
         /* create related calculation */
         $calc = new ECalculation();
         $calc->setPeriodId($periodId);
         $dateStarted = $this->_toolDate->getUtcNowForDb();
         $calc->setDateStarted($dateStarted);
         $calc->setState(Cfg::CALC_STATE_STARTED);
         $calcId = $this->_repoCalc->create($calc);
         $calc->setId($calcId);
         /* place new objects into response */
         $result->setDependentPeriodData($period);
         $result->setDependentCalcData($calc);
     }
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_bonus_base,代码行数:43,代码来源:Depended.php

示例9: update

 /**
  * updates Activity Document Link
  * @param array                $documentLink
  * @param ActivityDocumentLink $activityDocumentLink
  * @return bool
  */
 public function update(array $documentLink, ActivityDocumentLink $activityDocumentLink)
 {
     try {
         $this->database->beginTransaction();
         $documentLinkExists = $activityDocumentLink->exists;
         $activityId = $activityDocumentLink->activity_id;
         $documentManager = app(DocumentManager::class);
         if ($documentLinkExists) {
             $url = $activityDocumentLink->document_link['url'];
             $document = $documentManager->getDocument(session('org_id'), $url);
             $activities = (array) $document->activities;
             unset($activities[$activityId]);
             $document->activities = $activities;
             $documentManager->update($document);
         }
         $url = $documentLink[0]['url'];
         $document = $documentManager->getDocument(session('org_id'), $url);
         $activities = (array) $document->activities;
         $identifier = $activityDocumentLink->activity->identifier['activity_identifier'];
         $activities[$activityId] = $identifier;
         $document->activities = $activities;
         $documentManager->update($document);
         $this->DocumentLinkRepo->update($documentLink, $activityDocumentLink);
         $this->database->commit();
         $this->logger->info(sprintf('Activity Document Link %s!', $documentLinkExists ? 'updated' : 'saved'), ['for' => $documentLink]);
         $this->dbLogger->activity(sprintf("activity.document_link_%s", $documentLinkExists ? 'updated' : 'saved'), ['activity_id' => $activityDocumentLink->activity_id, 'document_link_id' => $activityDocumentLink->id, 'organization' => $this->auth->user()->organization->name, 'organization_id' => $this->auth->user()->organization->id]);
         return true;
     } catch (\Exception $exception) {
         $this->database->rollback();
         $this->logger->error($exception, ['documentLink' => $documentLink]);
     }
     return false;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:39,代码来源:DocumentLinkManager.php

示例10: r4_add_record

 protected function r4_add_record(CreatedDomain $domain, Record $record)
 {
     if ($this->logger) {
         $this->logger->info("Adding " . $record->name);
     }
     return $domain->add_record($record, $this->api);
 }
开发者ID:splitice,项目名称:rage4-api-objective,代码行数:7,代码来源:SimpleSync.php

示例11: log

 /**
  * @param $message
  * @param $context
  */
 private function log($message, $context = [])
 {
     if ($this->logger instanceof LoggerInterface) {
         $context['class'] = self::class;
         $this->logger->info($message, $context);
     }
 }
开发者ID:WeCamp,项目名称:ardo,代码行数:11,代码来源:InputPlugin.php

示例12: run

 /**
  * Run the daemon.
  *
  * @return int
  */
 public function run()
 {
     $this->logger->info("Status: starting up.");
     while (true) {
         $this->taskPersist->begin();
         $tasks = $this->tasksFinder->findDueTasks();
         foreach ($tasks as $task) {
             try {
                 $handlerClass = $task->getHandlerClass();
                 /** @var TaskHandlerInterface $handler */
                 $handler = new $handlerClass(...$task->getArguments());
                 $this->decorate($handler);
                 $this->logger->info("Handle {$handlerClass}");
                 $handler->handle();
                 if ($task->isReoccurring()) {
                     $task->reoccur();
                     $this->taskPersist->persist($task);
                 } else {
                     $this->taskPersist->remove($task);
                 }
             } catch (Exception $e) {
                 $this->logger->error("{$e->getMessage()}\n{$e->getTraceAsString()}");
                 $task->setDisabled();
                 $this->taskPersist->persist($task);
             }
         }
         $this->taskPersist->commit();
         sleep(1);
     }
 }
开发者ID:messyOne,项目名称:Daemon,代码行数:35,代码来源:Daemon.php

示例13: info

 public static function info($msg, $context = array())
 {
     if (!self::$_impl) {
         return;
     }
     self::$_impl->info($msg, $context);
 }
开发者ID:jinchunguang,项目名称:qpm,代码行数:7,代码来源:Logger.php

示例14: runCrons

 public function runCrons()
 {
     $entityManager = $this->managerRegistry->getManagerForClass('DspSoftsCronManagerBundle:CronTask');
     $cronTaskRepo = $entityManager->getRepository('DspSoftsCronManagerBundle:CronTask');
     $cronTasks = $cronTaskRepo->findCronsToLaunch();
     foreach ($cronTasks as $cronTask) {
         $run = true;
         if (!$cronTask->getRelaunch()) {
             $run = $this->planificationChecker->isExecutionDue($cronTask->getPlanification());
         }
         if ($run) {
             if ($this->logger !== null) {
                 $this->logger->info(sprintf('Running Cron Task <info>%s</info>', $cronTask->getName()));
             }
             $cli = 'exec ' . $this->kernelRootDir . DIRECTORY_SEPARATOR . 'console dsp:cron:runjob -c ' . $cronTask->getId() . ' &';
             if ($this->logger !== null) {
                 $this->logger->info(sprintf('Command line : <info>%s</info>', $cli));
             }
             $process = new Process($cli);
             $process->setTimeout(0);
             $process->start();
         } else {
             if ($this->logger !== null) {
                 $this->logger->info(sprintf('Skipping Cron Task <info>%s</info>', $cronTask->getName()));
             }
         }
     }
 }
开发者ID:dspsofts,项目名称:cronmanager-bundle,代码行数:28,代码来源:CronManipulator.php

示例15: inlineQuery

 public function inlineQuery(Update $update) : unreal4uBot
 {
     $this->logger->info(sprintf('Received inline query. User id %d (username: %s). Query: "%s", inline query id: %s', $update->inline_query->from->id, $update->inline_query->from->username, $update->inline_query->query, $update->inline_query->id));
     $query = $update->inline_query->query;
     if (empty($query)) {
         $query = 'What is lmgtfy?';
     }
     // Number of results
     $i = 1;
     $inlineQueryResultArticle = new Article();
     $inlineQueryResultArticle->url = 'http://lmgtfy.com/?q=' . urlencode($query);
     $inlineQueryResultArticle->title = $inlineQueryResultArticle->url;
     //'Forward this message to anyone you would like (Title)';
     $inlineQueryResultArticle->hide_url = true;
     $inputMessageContentText = new Text();
     $inputMessageContentText->message_text = $inlineQueryResultArticle->url;
     $inputMessageContentText->disable_web_page_preview = true;
     $inlineQueryResultArticle->input_message_content = $inputMessageContentText;
     // @TODO find a way to compress this all into an identifiable 64bit ascii string, maybe with pack()?
     $inlineQueryResultArticle->id = md5(json_encode(['uid' => $update->inline_query->from->id, 'iqid' => $update->inline_query->id, 'rid' => $i]));
     $answerInlineQuery = new AnswerInlineQuery();
     $answerInlineQuery->inline_query_id = $update->inline_query->id;
     $answerInlineQuery->addResult($inlineQueryResultArticle);
     $tgLog = new TgLog($this->token, $this->logger);
     //$tgLog->logger = $this->logger;
     $tgLog->performApiRequest($answerInlineQuery);
     $this->logger->info(sprintf('Sent API response to Telegram, all done'));
     return $this;
 }
开发者ID:unreal4u,项目名称:tg-timebot,代码行数:29,代码来源:unreal4uBot.php


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