You are here

class Drush9LogMigrateMessage in Migrate Tools 8.5

Same name and namespace in other branches
  1. 8.4 src/Drush9LogMigrateMessage.php \Drupal\migrate_tools\Drush9LogMigrateMessage

Print message in drush from migrate message. Drush 9 version.

@package Drupal\migrate_tools

Hierarchy

Expanded class hierarchy of Drush9LogMigrateMessage

1 file declares its use of Drush9LogMigrateMessage
MigrateToolsCommands.php in src/Commands/MigrateToolsCommands.php

File

src/Drush9LogMigrateMessage.php, line 15

Namespace

Drupal\migrate_tools
View source
class Drush9LogMigrateMessage implements MigrateMessageInterface, LoggerAwareInterface {
  use LoggerAwareTrait;

  /**
   * The map between migrate status and drush log levels.
   *
   * @var array
   */
  protected $map = [
    'status' => 'notice',
  ];

  /**
   * DrushLogMigrateMessage constructor.
   */
  public function __construct(LoggerInterface $logger) {
    $this
      ->setLogger($logger);
  }

  /**
   * Output a message from the migration.
   *
   * @param string $message
   *   The message to display.
   * @param string $type
   *   The type of message to display.
   */
  public function display($message, $type = 'status') {
    $type = isset($this->map[$type]) ? $this->map[$type] : $type;
    $this->logger
      ->log($type, $message);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drush9LogMigrateMessage::$map protected property The map between migrate status and drush log levels.
Drush9LogMigrateMessage::display public function Output a message from the migration. Overrides MigrateMessageInterface::display
Drush9LogMigrateMessage::__construct public function DrushLogMigrateMessage constructor.