
| Current Path : /var/www/html/strat/web/core/modules/system/tests/modules/error_service_test/src/Logger/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php |
<?php
namespace Drupal\error_service_test\Logger;
use Drupal\Core\Logger\RfcLoggerTrait;
use Psr\Log\LoggerInterface;
/**
* Throws an exception while logging an exception.
*
* @see \Drupal\system\Tests\System\UncaughtExceptionTest::testLoggerException()
*/
class TestLog implements LoggerInterface {
use RfcLoggerTrait;
/**
* {@inheritdoc}
*/
public function log($level, string|\Stringable $message, array $context = []): void {
$trigger = [
'%type' => 'Exception',
'@message' => 'Deforestation',
'%function' => 'Drupal\error_service_test\MonkeysInTheControlRoom->handle()',
'severity_level' => 3,
'channel' => 'php',
];
if (array_diff_assoc($trigger, $context) === []) {
throw new \Exception('Oh, oh, frustrated monkeys!');
}
}
}