class DrushLogMigrateMessage in Migrate Manifest 8
Same name and namespace in other branches
- 8.2 src/DrushLogMigrateMessage.php \Drupal\migrate_manifest\DrushLogMigrateMessage
- 3.x src/DrushLogMigrateMessage.php \Drupal\migrate_manifest\DrushLogMigrateMessage
Simple Migrate Message implementation that uses drush to output.
@package Drupal\migrate_manifest
Hierarchy
- class \Drupal\migrate_manifest\DrushLogMigrateMessage implements MigrateMessageInterface
Expanded class hierarchy of DrushLogMigrateMessage
1 file declares its use of DrushLogMigrateMessage
- DrushLogMigrateMessageTest.php in tests/
src/ Unit/ DrushLogMigrateMessageTest.php
File
- src/
DrushLogMigrateMessage.php, line 14
Namespace
Drupal\migrate_manifestView source
class DrushLogMigrateMessage implements MigrateMessageInterface {
/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
public function __construct(LoggerInterface $logger = NULL) {
if (!isset($logger)) {
$logger = Drush::logger();
}
$this->logger = $logger;
}
/**
* @inheritdoc
*/
public function display($message, $type = 'status') {
if (method_exists($this->logger, $type)) {
$this->logger
->{$type}($message);
}
elseif ($type == 'status') {
$this->logger
->info($message);
}
else {
$this->logger
->warning('Logger called with unknown type: @type', [
'@type' => $type,
]);
$this->logger
->info($message);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrushLogMigrateMessage:: |
protected | property | ||
DrushLogMigrateMessage:: |
public | function |
@inheritdoc Overrides MigrateMessageInterface:: |
|
DrushLogMigrateMessage:: |
public | function |