<?php

namespace Drupal\{{ machine_name }};

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Defines a service provider for the {{ name }} module.
 */
class {{ class }} extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) {
    $container->register('{{ machine_name }}.subscriber', 'Drupal\{{ machine_name }}\EventSubscriber\{{ machine_name|camelize }}Subscriber')
      ->addTag('event_subscriber')
      ->addArgument(new Reference('entity_type.manager'));
  }

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $modules = $container->getParameter('container.modules');
    if (isset($modules['dblog'])) {
      // Override default DB logger to exclude some unwanted log messages.
      $container->getDefinition('logger.dblog')
        ->setClass('Drupal\{{ machine_name }}\Logger\{{ machine_name|camelize }}Log');
    }
  }

}
