You are here

public function Drupal8::watchdog in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::watchdog()
  2. 7.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::watchdog()

Logs something to the watchdog.

See watchdog() for more details on this function.

Parameters

mixed $message: A message to log.

int $severity: The litteral severity as defined in: https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/watc..., The default being WATCHDOG_NOTICE or 5. We cannot use the constants here because PHPUnit and Drupal 8 do not know about them.

Overrides Framework::watchdog

1 call to Drupal8::watchdog()
Drupal8::debug in api/src/Framework/Drupal8.php
Prints debugging information.

File

api/src/Framework/Drupal8.php, line 283

Class

Drupal8
Drupal 8-specific code.

Namespace

Drupal\realistic_dummy_content_api\Framework

Code

public function watchdog($message, $severity = 5) {
  if ($severity == WATCHDOG_ERROR) {

    // @phpstan-ignore-next-line
    \Drupal::logger('realistic_dummy_content_api')
      ->error($message);
  }
  else {

    // @phpstan-ignore-next-line
    \Drupal::logger('realistic_dummy_content_api')
      ->notice($message);
  }
}