You are here

class TestLog in Drupal 8

Same name and namespace in other branches
  1. 9 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, $message, array $context = []) {
    $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

Namesort descending Modifiers Type Description Overrides
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 Logs with an arbitrary level. Overrides RfcLoggerTrait::log