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
- class \Drupal\mongodb_watchdog\Logger extends \Psr\Log\AbstractLogger uses StringTranslationTrait
- class \Drupal\Tests\mongodb_watchdog\Unit\MockLogger
Expanded class hierarchy of MockLogger
File
- modules/
mongodb_watchdog/ tests/ src/ Unit/ MockLogger.php, line 19
Namespace
Drupal\Tests\mongodb_watchdog\UnitView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Logger:: |
protected | property | The logger storage. | |
Logger:: |
protected | property | The limit for the capped event collections. | |
Logger:: |
protected | property | The minimum logging level. | |
Logger:: |
protected | property | The messenger service. | |
Logger:: |
protected | property | The message's placeholders parser. | |
Logger:: |
protected | property | The "requests" setting. | |
Logger:: |
protected | property | The request_stack service. | |
Logger:: |
protected | property | Is request tracking enabled ? | |
Logger:: |
protected | property | Map of PSR3 log constants to RFC 5424 log constants. | |
Logger:: |
protected | property | A sequence number for log events during a request. | |
Logger:: |
protected | property | An array of templates already used in this request. | |
Logger:: |
protected | property | The datetime.time service. | |
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
public | function | Ensure a collection is capped with the proper size. | |
Logger:: |
public | function | Ensure a collection exists in the logger database. | |
Logger:: |
public | function | Ensure indexes are set on the collections and tracker collection is capped. | |
Logger:: |
public | function | Return a collection, given its template id. | |
Logger:: |
public | function | List the event collections. | |
Logger:: |
public | function | Return the number of events for a template. | |
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
public | function | ||
Logger:: |
constant | |||
Logger:: |
public | function | Return the events having occurred during a given request. | |
Logger:: |
public | function | Count events matching a request unique_id. | |
Logger:: |
public | function | Return an array of templates uses during a given request. | |
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
constant | |||
Logger:: |
public | function | Setter for limit. | |
Logger:: |
public | function | Return the event templates collection. | |
Logger:: |
public | function | Return templates matching type and level criteria. | |
Logger:: |
public | function | Return the number of event templates. | |
Logger:: |
public | function | Return the template types actually present in storage. | |
Logger:: |
constant | |||
Logger:: |
public | function | Return the request events tracker collection. | |
Logger:: |
constant | |||
MockLogger:: |
public | function |
Fill in the log_entry function, file, and line. Overrides Logger:: |
|
MockLogger:: |
public | function |
TestLogger mock constructor. Overrides Logger:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |