private function ControllerTest::insertLogEntries in MongoDB 8.2
Generate dblog entries.
Parameters
\Psr\Log\LoggerInterface $logger: The mongodb.logger service.
int $count: Number of log entries to generate.
string $type: The type of watchdog entry.
int $severity: The severity of the watchdog entry.
1 call to ControllerTest::insertLogEntries()
- ControllerTest::testFilter in modules/
mongodb_watchdog/ tests/ src/ Functional/ ControllerTest.php - Test the dblog filter on admin/reports/dblog.
File
- modules/
mongodb_watchdog/ tests/ src/ Functional/ ControllerTest.php, line 356
Class
- ControllerTest
- Test the MongoDB report controllers.
Namespace
Drupal\Tests\mongodb_watchdog\FunctionalCode
private function insertLogEntries(LoggerInterface $logger, int $count, string $type = 'custom', int $severity = RfcLogLevel::EMERGENCY) {
$ip = '::1';
$context = [
'channel' => $type,
'link' => NULL,
'user' => [
'uid' => $this->bigUser
->id(),
],
'request_uri' => "http://[{$ip}]/",
'referer' => $_SERVER['HTTP_REFERER'] ?? '',
'ip' => $ip,
'timestamp' => $this->requestTime,
];
$message = $this
->randomString();
for ($i = 0; $i < $count; $i++) {
$logger
->log($severity, $message, $context);
}
}