You are here

function mongodb_watchdog_install in MongoDB 8.2

Same name and namespace in other branches
  1. 8 mongodb_watchdog/mongodb_watchdog.install \mongodb_watchdog_install()
  2. 6 mongodb_watchdog/mongodb_watchdog.install \mongodb_watchdog_install()
  3. 7 mongodb_watchdog/mongodb_watchdog.install \mongodb_watchdog_install()

Implements hook_install().

File

modules/mongodb_watchdog/mongodb_watchdog.install, line 14
MongoDB watchdog install file.

Code

function mongodb_watchdog_install() {

  // Autoloader naming the service is not yet available.
  $name = 'mongodb.logger';

  // Service may have been instantiated with an empty config before this hook,
  // so drop the instance to create a new one now that config is available.
  \Drupal::getContainer()
    ->set($name, NULL);

  /** @var \Drupal\mongodb_watchdog\Logger $logger */
  $logger = \Drupal::service($name);
  $logger
    ->ensureSchema();
}