DrushLogMigrateMessage.php in Migrate Manifest 3.x
File
src/DrushLogMigrateMessage.php
View source
<?php
namespace Drupal\migrate_manifest;
use Drupal\migrate\MigrateMessageInterface;
use Drush\Drush;
use Psr\Log\LoggerInterface;
class DrushLogMigrateMessage implements MigrateMessageInterface {
protected $logger;
public function __construct(LoggerInterface $logger = NULL) {
if (!isset($logger)) {
$logger = Drush::logger();
}
$this->logger = $logger;
}
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);
}
}
}