class TestLog

Same name in other branches
  1. 9 core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php \Drupal\error_service_test\Logger\TestLog
  2. 8.9.x core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php \Drupal\error_service_test\Logger\TestLog
  3. 11.x core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php \Drupal\error_service_test\Logger\TestLog

Throws an exception while logging an exception.

Hierarchy

Expanded class hierarchy of TestLog

See also

\Drupal\system\Tests\System\UncaughtExceptionTest::testLoggerException()

1 string reference to 'TestLog'
error_service_test.services.yml in core/modules/system/tests/modules/error_service_test/error_service_test.services.yml
core/modules/system/tests/modules/error_service_test/error_service_test.services.yml
1 service uses TestLog
logger.broken in core/modules/system/tests/modules/error_service_test/error_service_test.services.yml
Drupal\error_service_test\Logger\TestLog

File

core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php, line 13

Namespace

Drupal\error_service_test\Logger
View source
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!');
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
RfcLoggerTrait::alert public function
RfcLoggerTrait::critical public function
RfcLoggerTrait::debug public function
RfcLoggerTrait::emergency public function
RfcLoggerTrait::error public function
RfcLoggerTrait::info public function
RfcLoggerTrait::notice public function
RfcLoggerTrait::warning public function
TestLog::log public function Overrides RfcLoggerTrait::log

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.