3 namespace Drupal\error_service_test\Logger;
5 use Drupal\Core\Logger\RfcLoggerTrait;
6 use Psr\Log\LoggerInterface;
9 * Throws an exception while logging an exception.
11 * @see \Drupal\system\Tests\System\UncaughtExceptionTest::testLoggerException()
13 class TestLog implements LoggerInterface {
19 public function log($level, $message, array $context = []) {
21 '%type' => 'Exception',
22 '@message' => 'Deforestation',
23 '%function' => 'Drupal\error_service_test\MonkeysInTheControlRoom->handle()',
24 'severity_level' => 3,
27 if (array_diff_assoc($trigger, $context) === []) {
28 throw new \Exception('Oh, oh, frustrated monkeys!');