info() public method

public info ( $message, array $context = [] )
$context array
 /**
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return null
  * @throws PsrInvalidArgumentException
  */
 public function log($level, $message, array $context = array())
 {
     switch ($level) {
         case PsrLogLevel::ALERT:
             $this->symfonyLogger->alert($message, $context);
             break;
         case PsrLogLevel::CRITICAL:
             $this->symfonyLogger->crit($message, $context);
             break;
         case PsrLogLevel::DEBUG:
             $this->symfonyLogger->debug($message, $context);
             break;
         case PsrLogLevel::EMERGENCY:
             $this->symfonyLogger->emerg($message, $context);
             break;
         case PsrLogLevel::ERROR:
             $this->symfonyLogger->err($message, $context);
             break;
         case PsrLogLevel::INFO:
             $this->symfonyLogger->info($message, $context);
             break;
         case PsrLogLevel::NOTICE:
             $this->symfonyLogger->notice($message, $context);
             break;
         case PsrLogLevel::WARNING:
             $this->symfonyLogger->warn($message, $context);
             break;
         default:
             throw new PsrInvalidArgumentException(sprintf('Loglevel "%s" not valid, use constants from "%s"', $level, "Psr\\Log\\LogLevel"));
             break;
     }
     return null;
 }
 public function spamCheck(CommentPersistEvent $event)
 {
     $comment = $event->getComment();
     if ($this->spamDetector->isSpam($comment)) {
         if (null !== $this->logger) {
             $this->logger->info('Comment is marked as spam from detector, aborting persistence.');
         }
         $event->abortPersistence();
     }
 }
 /**
  * Log a resource unsubscription attempt.
  * @param boolean $successful Whether the attempt succeeded.
  * @param array $url The resource URLs.
  */
 public function logUnsubscribeAttempt($successful, array $urls)
 {
     // Write the actual logs
     foreach ($urls as $url) {
         if ($successful) {
             $this->logger->info(sprintf('Unsubscribed from resource "%s"', $url));
         } else {
             $this->logger->warn(sprintf('Unsuccessful unsubscription attempt from resource "%s"', $url));
         }
     }
     // Store the data directly
     $this->unsubscribeAttempts[] = new UnsubscribeAttempt($successful, $urls);
 }
 /**
  * @param GetResponseEvent $event
  *
  * @return GetResponseEvent
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     try {
         $this->routerListener->onKernelRequest($event);
     } catch (NotFoundHttpException $e) {
         if (null !== $this->logger) {
             $this->logger->info('Request handled by the ' . $this->legacyKernel->getName() . ' kernel.');
         }
         $response = $this->legacyKernel->handle($event->getRequest(), $event->getRequestType(), true);
         if ($response->getStatusCode() !== 404) {
             $event->setResponse($response);
             return $event;
         }
     }
 }
 /**
  * @param string                     $value         value to geocode
  * @param float                      $duration      geocoding duration
  * @param string                     $providerClass Geocoder provider class name
  * @param \SplObjectStorage|Geocoded $results
  */
 public function logRequest($value, $duration, $providerClass, $results)
 {
     if (null !== $this->logger) {
         $this->logger->info(sprintf("%s %0.2f ms (%s)", $value, $duration, $providerClass));
     }
     $data = array();
     if ($results instanceof \SplObjectStorage) {
         $data = array();
         foreach ($results as $result) {
             $data[] = $result->toArray();
         }
     } else {
         $data = $results->toArray();
     }
     $this->requests[] = array('value' => $value, 'duration' => $duration, 'providerClass' => $providerClass, 'result' => json_encode($data));
 }
 public function onResponse(Event $event)
 {
     $response = $event->getResponse();
     /* @var $response \Symfony\Component\HttpFoundation\Response */
     $session = $event->getRequest()->getSession();
     /* @var $session \Symfony\Component\HttpFoundation\Session */
     $response->headers->setCookie(new Cookie('locale', $session->get('localeIdentified')));
     if (null !== $this->logger) {
         $this->logger->info(sprintf('Locale Cookie set to: [ %s ]', $session->get('localeIdentified')));
     }
 }
 public function addDcIfNotExist($dn, $name)
 {
     if (!$this->ldap->isEntityExist($dn)) {
         $data = array();
         $data['dc'] = $name;
         $data['o'] = $name;
         $data['objectclass'] = array('top', 'organization', 'dcObject');
         $this->ldap->add($dn, $data);
         $this->logger->info("Created Dc:'" . $dn . "''");
     }
 }
 /**
  * Takes a bundle and update its contributors
  *
  * @param Bundle $bundle
  */
 private function updateContributors(Bundle $bundle)
 {
     $contributorNames = $this->githubRepoApi->getContributorNames($bundle);
     $contributors = array();
     foreach ($contributorNames as $contributorName) {
         $contributors[] = $this->ownerManager->createOwner($contributorName, 'unknown');
     }
     $bundle->setContributors($contributors);
     if ($this->logger) {
         $this->logger->info(sprintf('%d contributor(s) have been retrieved for bundle %s', count($contributors), $bundle->getName()));
     }
 }
 /**
  * {@inheritDoc}
  */
 public function execute(AMQPMessage $msg)
 {
     if ($this->logger) {
         $this->logger->info('[GithubHookConsumer] Received a github post push hook');
     }
     if (null === ($message = json_decode($msg->body))) {
         if ($this->logger) {
             $this->logger->err('[GithubHookConsumer] Unable to decode payload');
         }
         return;
     }
     $payload = $message->payload;
     $bundle = $this->manager->getRepository('KnpBundlesBundle:Bundle')->findOneBy(array('name' => $payload->repository->name, 'ownerName' => $payload->repository->owner->name));
     if (!$bundle) {
         if ($this->logger) {
             $this->logger->warn(sprintf('[GithubHookConsumer] unknown bundle %s/%s', $payload->repository->name, $payload->repository->owner->name));
         }
         return;
     }
     $this->producer->publish(serialize(array('bundle_id' => $bundle->getId())));
 }
 /**
  * Loops through all registered routers and returns a router if one is found.
  * It will always return the first route generated.
  *
  * @param  string                 $name
  * @param  array                  $parameters
  * @param  Boolean                $absolute
  * @throws RouteNotFoundException
  * @return string
  */
 public function generate($name, $parameters = array(), $absolute = false)
 {
     foreach ($this->all() as $router) {
         try {
             return $router->generate($name, $parameters, $absolute);
         } catch (RouteNotFoundException $e) {
             if ($this->logger) {
                 $this->logger->info($e->getMessage());
             }
         }
     }
     throw new RouteNotFoundException(sprintf('None of the chained routers were able to generate route "%s".', $name));
 }
 /**
  * Extract messages to MessageCatalogue.
  *
  * @return MessageCatalogue
  *
  * @throws \Exception|\RuntimeException
  */
 public function extract()
 {
     if ($this->catalogue) {
         throw new \RuntimeException('Invalid state');
     }
     $this->catalogue = new MessageCatalogue();
     foreach ($this->adminPool->getAdminServiceIds() as $id) {
         $admin = $this->getAdmin($id);
         $this->translator = $admin->getTranslator();
         $this->labelStrategy = $admin->getLabelTranslatorStrategy();
         $this->domain = $admin->getTranslationDomain();
         $admin->setTranslator($this);
         $admin->setSecurityHandler($this);
         $admin->setLabelTranslatorStrategy($this);
         //            foreach ($admin->getChildren() as $child) {
         //                $child->setTranslator($this);
         //            }
         // call the different public method
         $methods = array('getShow' => array(array()), 'getDatagrid' => array(array()), 'getList' => array(array()), 'getForm' => array(array()), 'getBreadcrumbs' => array(array('list'), array('edit'), array('create'), array('update'), array('batch'), array('delete')));
         if ($this->logger) {
             $this->logger->info(sprintf('Retrieving message from admin:%s - class: %s', $admin->getCode(), get_class($admin)));
         }
         foreach ($methods as $method => $calls) {
             foreach ($calls as $args) {
                 try {
                     call_user_func_array(array($admin, $method), $args);
                 } catch (\Exception $e) {
                     if ($this->logger) {
                         $this->logger->error(sprintf('ERROR : admin:%s - Raise an exception : %s', $admin->getCode(), $e->getMessage()));
                     }
                     throw $e;
                 }
             }
         }
     }
     $catalogue = $this->catalogue;
     $this->catalogue = false;
     return $catalogue;
 }
Example #12
0
 /**
  * A convenience function for logging an critical event.
  *
  * @param mixed $message the message to log.
  */
 public function info($message)
 {
     if (null !== $this->logger) {
         $this->logger->info($message);
     }
 }
 protected function log($message)
 {
     if (!empty($this->logger)) {
         $this->logger->info($message);
     }
 }
Example #14
0
 /**
  * A convenience function for logging an critical event.
  *
  * @param mixed $message the message to log.
  */
 public function info($message)
 {
     $this->logger->info($message);
 }
Example #15
0
 public function onEngineEvent(Event $event, $name, EventDispatcherInterface $dispatcher)
 {
     $this->logger->info(sprintf('FDA:TournamentEngine: event "%s" just happened!', $name));
 }