You are here

public function HookWatchdog::convert in Drupal 7 to 8/9 Module Upgrader 8

Performs required conversions.

Parameters

TargetInterface $target: The target module to convert.

Overrides ConverterInterface::convert

File

src/Plugin/DMU/Converter/HookWatchdog.php, line 20

Class

HookWatchdog
Plugin annotation @Converter( id = "hook_watchdog", description = @Translation("Converts hook_watchdog() to an implementation of \\Psr\\Log\\LoggerInterface."), hook = "hook_watchdog" )

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Converter

Code

public function convert(TargetInterface $target) {
  $this
    ->writeService($target, 'default_logger', [
    'class' => 'Drupal\\' . $target
      ->id() . '\\Logger\\DefaultLogger',
    'tags' => [
      [
        'name' => 'logger',
      ],
    ],
  ]);
  $render = [
    '#theme' => 'dmu_logger',
    '#module' => $target
      ->id(),
  ];
  $this
    ->writeClass($target, $this
    ->parse($render));
}