You are here

public function TestLog::log in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php \Drupal\error_service_test\Logger\TestLog::log()

Logs with an arbitrary level.

Parameters

mixed $level:

string $message:

array $context:

Return value

null

Overrides RfcLoggerTrait::log

File

core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php, line 24
Contains \Drupal\error_service_test\Logger\TestLog.

Class

TestLog
Throws an exception while logging an exception.

Namespace

Drupal\error_service_test\Logger

Code

public function log($level, $message, array $context = array()) {
  $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!');
  }
}