You are here

class TeeLogger in Backup and Migrate 5.0.x

@package Drupal\backup_migrate\Core\Tests\Service

Hierarchy

  • class \Drupal\backup_migrate\Core\Service\TeeLogger extends \Psr\Log\AbstractLogger

Expanded class hierarchy of TeeLogger

1 file declares its use of TeeLogger
Notify.php in src/Core/Filter/Notify.php

File

src/Core/Service/TeeLogger.php, line 13

Namespace

Drupal\backup_migrate\Core\Service
View source
class TeeLogger extends AbstractLogger {

  /**
   * @var \Psr\Log\LoggerInterface[]
   */
  protected $loggers;

  /**
   * @param \Psr\Log\LoggerInterface[] $loggers
   */
  public function __construct(array $loggers) {
    $this
      ->setLoggers($loggers);
  }

  /**
   * Logs with an arbitrary level.
   *
   * @param mixed $level
   * @param string $message
   * @param array $context
   */
  public function log($level, $message, array $context = []) {
    foreach ($this
      ->getLoggers() as $logger) {
      $logger
        ->log($level, $message, $context);
    }
  }

  /**
   * @return \Psr\Log\LoggerInterface[]
   */
  public function getLoggers() {
    return $this->loggers;
  }

  /**
   * @param \Psr\Log\LoggerInterface[] $loggers
   */
  public function setLoggers(array $loggers) {
    $this->loggers = $loggers;
  }

  /**
   * @param \Psr\Log\LoggerInterface $logger
   */
  public function addLogger(LoggerInterface $logger) {
    $this->loggers[] = $logger;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TeeLogger::$loggers protected property
TeeLogger::addLogger public function
TeeLogger::getLoggers public function
TeeLogger::log public function Logs with an arbitrary level.
TeeLogger::setLoggers public function
TeeLogger::__construct public function