class TestLog
Throws an exception while logging an exception.
Hierarchy
- class \Drupal\error_service_test\Logger\TestLog implements \Psr\Log\LoggerInterface uses \Drupal\Core\Logger\RfcLoggerTrait
 
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\LoggerView 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
| 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.