public function TestSystemLoggerChannel::log in Drupal 9
Overrides LoggerChannel::log
See also
\Drupal\Tests\system\Functional\SecurityAdvisories\SecurityAdvisoriesTestTrait::assertServiceAdvisoryLoggedErrors()
File
- core/
modules/ system/ tests/ modules/ advisory_feed_test/ src/ TestSystemLoggerChannel.php, line 47
Class
- TestSystemLoggerChannel
- Provides a decorator for the 'logger.channel.system' service for testing.
Namespace
Drupal\advisory_feed_testCode
public function log($level, $message, array $context = []) : void {
if ($level === LogLevel::ERROR) {
$messages = $this->state
->get('advisory_feed_test.error_messages', []);
$messages[] = $message;
$this->state
->set('advisory_feed_test.error_messages', $messages);
}
$this->innerLogger
->log($level, $message, $context);
}