You are here

class TestLogger in Feeds 8.3

Logger for testing log messages.

Hierarchy

Expanded class hierarchy of TestLogger

1 file declares its use of TestLogger
FeedTest.php in tests/src/Kernel/Entity/FeedTest.php

File

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

Namespace

Drupal\Tests\feeds\Kernel
View source
class TestLogger implements LoggerInterface {
  use RfcLoggerTrait;

  /**
   * Array of logged messages.
   *
   * @var array
   */
  protected $messages = [];

  /**
   * {@inheritdoc}
   */
  public function log($level, $message, array $context = []) {
    $this->messages[] = strtr($message, $context);
  }

  /**
   * Returns the logged messages.
   *
   * @return array
   *   An array of all logged messages.
   */
  public function getMessages() : array {
    return $this->messages;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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::$messages protected property Array of logged messages.
TestLogger::getMessages public function Returns the logged messages.
TestLogger::log public function Logs with an arbitrary level. Overrides RfcLoggerTrait::log