Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / system / tests / modules / error_service_test / src / Logger / TestLog.php
1 <?php
2
3 namespace Drupal\error_service_test\Logger;
4
5 use Drupal\Core\Logger\RfcLoggerTrait;
6 use Psr\Log\LoggerInterface;
7
8 /**
9  * Throws an exception while logging an exception.
10  *
11  * @see \Drupal\system\Tests\System\UncaughtExceptionTest::testLoggerException()
12  */
13 class TestLog implements LoggerInterface {
14   use RfcLoggerTrait;
15
16   /**
17    * {@inheritdoc}
18    */
19   public function log($level, $message, array $context = []) {
20     $trigger = [
21       '%type' => 'Exception',
22       '@message' => 'Deforestation',
23       '%function' => 'Drupal\error_service_test\MonkeysInTheControlRoom->handle()',
24       'severity_level' => 3,
25       'channel' => 'php',
26     ];
27     if (array_diff_assoc($trigger, $context) === []) {
28       throw new \Exception('Oh, oh, frustrated monkeys!');
29     }
30   }
31
32 }