[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/http-kernel/EventListener/ -> ErrorsLoggerListener.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\HttpKernel\EventListener;
  13  
  14  @trigger_error('The '.__NAMESPACE__.'\ErrorsLoggerListener class is deprecated since Symfony 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\DebugHandlersListener class instead.', E_USER_DEPRECATED);
  15  
  16  use Psr\Log\LoggerInterface;
  17  use Symfony\Component\Debug\ErrorHandler;
  18  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  19  use Symfony\Component\HttpKernel\KernelEvents;
  20  
  21  /**
  22   * Injects the logger into the ErrorHandler, so that it can log various errors.
  23   *
  24   * @author Colin Frei <colin@colinfrei.com>
  25   * @author Konstantin Myakshin <koc-dp@yandex.ru>
  26   *
  27   * @deprecated since version 2.6, to be removed in 3.0. Use the DebugHandlersListener class instead.
  28   */
  29  class ErrorsLoggerListener implements EventSubscriberInterface
  30  {
  31      private $channel;
  32      private $logger;
  33  
  34      public function __construct($channel, LoggerInterface $logger = null)
  35      {
  36          $this->channel = $channel;
  37          $this->logger = $logger;
  38      }
  39  
  40      public function injectLogger()
  41      {
  42          if (null !== $this->logger) {
  43              ErrorHandler::setLogger($this->logger, $this->channel);
  44              $this->logger = null;
  45          }
  46      }
  47  
  48      public static function getSubscribedEvents()
  49      {
  50          return array(KernelEvents::REQUEST => array('injectLogger', 2048));
  51      }
  52  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1