You are here

class MockLogger in MongoDB 8.2

Class MockLogger provides a Logger implementation usable in unit tests.

Normal implementations would require a slower kernel Test.

@package Drupal\Tests\mongodb_watchdog\Unit

Hierarchy

Expanded class hierarchy of MockLogger

File

modules/mongodb_watchdog/tests/src/Unit/MockLogger.php, line 19

Namespace

Drupal\Tests\mongodb_watchdog\Unit
View source
class MockLogger extends Logger {

  /**
   * TestLogger mock constructor.
   */
  public function __construct() {

    // This override avoids requiring actual services.
  }

  /**
   * {@inheritDoc}
   */
  public function enhanceLogEntry(array &$entry, array $backtrace) : void {
    parent::enhanceLogEntry($entry, $backtrace);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Logger::$database protected property The logger storage.
Logger::$items protected property The limit for the capped event collections.
Logger::$limit protected property The minimum logging level.
Logger::$messenger protected property The messenger service.
Logger::$parser protected property The message's placeholders parser.
Logger::$requests protected property The "requests" setting.
Logger::$requestStack protected property The request_stack service.
Logger::$requestTracking protected property Is request tracking enabled ?
Logger::$rfc5424levels protected property Map of PSR3 log constants to RFC 5424 log constants.
Logger::$sequence protected property A sequence number for log events during a request.
Logger::$templates protected property An array of templates already used in this request.
Logger::$time protected property The datetime.time service.
Logger::CONFIG_ITEMS constant
Logger::CONFIG_ITEMS_PER_PAGE constant
Logger::CONFIG_LIMIT constant
Logger::CONFIG_NAME constant
Logger::CONFIG_REQUESTS constant
Logger::CONFIG_REQUEST_TRACKING constant
Logger::DB_LOGGER constant
Logger::DEFAULT_CHANNEL constant
Logger::ensureCappedCollection public function Ensure a collection is capped with the proper size.
Logger::ensureCollection public function Ensure a collection exists in the logger database.
Logger::ensureSchema public function Ensure indexes are set on the collections and tracker collection is capped.
Logger::eventCollection public function Return a collection, given its template id.
Logger::eventCollections public function List the event collections.
Logger::eventCount public function Return the number of events for a template.
Logger::EVENT_COLLECTIONS_PATTERN constant
Logger::EVENT_COLLECTION_PREFIX constant
Logger::LEGACY_TYPE_MAP constant
Logger::log public function
Logger::MODULE constant
Logger::requestEvents public function Return the events having occurred during a given request.
Logger::requestEventsCount public function Count events matching a request unique_id.
Logger::requestTemplates public function Return an array of templates uses during a given request.
Logger::SERVICE_CHANNEL constant
Logger::SERVICE_LOGGER constant
Logger::SERVICE_REQUIREMENTS constant
Logger::SERVICE_SANITY_CHECK constant
Logger::setLimit public function Setter for limit.
Logger::templateCollection public function Return the event templates collection.
Logger::templates public function Return templates matching type and level criteria.
Logger::templatesCount public function Return the number of event templates.
Logger::templateTypes public function Return the template types actually present in storage.
Logger::TEMPLATE_COLLECTION constant
Logger::trackerCollection public function Return the request events tracker collection.
Logger::TRACKER_COLLECTION constant
MockLogger::enhanceLogEntry public function Fill in the log_entry function, file, and line. Overrides Logger::enhanceLogEntry
MockLogger::__construct public function TestLogger mock constructor. Overrides Logger::__construct
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.