You are here

class TestLogger in Search API Saved Searches 8

Provides a logger that throws exceptions when logging errors.

Hierarchy

Expanded class hierarchy of TestLogger

1 file declares its use of TestLogger
IntegrationTest.php in tests/src/Functional/IntegrationTest.php

File

tests/src/Kernel/TestLogger.php, line 14

Namespace

Drupal\Tests\search_api_saved_searches\Kernel
View source
class TestLogger extends LoggerChannel implements LoggerChannelFactoryInterface {
  use RfcLoggerTrait;

  /**
   * {@inheritdoc}
   */
  public function log($level, $message, array $context = []) {
    if ($level < RfcLogLevel::INFO) {
      $message = strtr($message, $context);
      throw new \Exception($message);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function get($channel) {
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function addLogger(LoggerInterface $logger, $priority = 0) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LoggerChannel::$callDepth protected property Number of times LoggerChannel::log() has been called for a single message.
LoggerChannel::$channel protected property The name of the channel of this logger instance.
LoggerChannel::$currentUser protected property The current user object.
LoggerChannel::$levelTranslation protected property Map of PSR3 log constants to RFC 5424 log constants.
LoggerChannel::$loggers protected property An array of arrays of \Psr\Log\LoggerInterface keyed by priority.
LoggerChannel::$requestStack protected property The request stack object.
LoggerChannel::MAX_CALL_DEPTH constant Maximum call depth to self::log() for a single log message.
LoggerChannel::setCurrentUser public function Sets the current user. Overrides LoggerChannelInterface::setCurrentUser
LoggerChannel::setLoggers public function Sets the loggers for this channel. Overrides LoggerChannelInterface::setLoggers
LoggerChannel::setRequestStack public function Sets the request stack. Overrides LoggerChannelInterface::setRequestStack
LoggerChannel::sortLoggers protected function Sorts loggers according to priority.
LoggerChannel::__construct public function Constructs a LoggerChannel object
RfcLoggerTrait::alert public function
RfcLoggerTrait::critical public function
RfcLoggerTrait::debug public function
RfcLoggerTrait::emergency public function
RfcLoggerTrait::error public function
RfcLoggerTrait::info public function
RfcLoggerTrait::notice public function
RfcLoggerTrait::warning public function
TestLogger::addLogger public function Adds a logger. Overrides LoggerChannel::addLogger
TestLogger::get public function Retrieves the registered logger for the requested channel. Overrides LoggerChannelFactoryInterface::get
TestLogger::log public function Logs with an arbitrary level. Overrides RfcLoggerTrait::log