You are here

class InMemoryLogger in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 tests/modules/search_api_solr_test/src/Logger/InMemoryLogger.php \Drupal\search_api_solr_test\Logger\InMemoryLogger
  2. 8 tests/modules/search_api_solr_test/src/Logger/InMemoryLogger.php \Drupal\search_api_solr_test\Logger\InMemoryLogger
  3. 8.2 tests/modules/search_api_solr_test/src/Logger/InMemoryLogger.php \Drupal\search_api_solr_test\Logger\InMemoryLogger

A simple in memory logger.

Hierarchy

  • class \Drupal\search_api_solr_test\Logger\InMemoryLogger extends \Psr\Log\AbstractLogger

Expanded class hierarchy of InMemoryLogger

1 file declares its use of InMemoryLogger
SolrBackendTestBase.php in tests/src/Kernel/SolrBackendTestBase.php

File

tests/modules/search_api_solr_test/src/Logger/InMemoryLogger.php, line 10

Namespace

Drupal\search_api_solr_test\Logger
View source
class InMemoryLogger extends AbstractLogger {
  private $messages = [];

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

  /**
   * Gets the last log message.
   */
  public function getLastMessage() {
    return end($this->messages);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InMemoryLogger::$messages private property
InMemoryLogger::getLastMessage public function Gets the last log message.
InMemoryLogger::log public function