Verified Commit 4b02386a authored by Abhishek Lal's avatar Abhishek Lal Committed by Travis Carden
Browse files

Issue #3310067 by Lal_, jcnventura, TravisCarden, nkoporec: Use...

Issue #3310067 by Lal_, jcnventura, TravisCarden, nkoporec: Use \Drush\Commands\DrushCommands::logger() in ChecklistapiCommands.
parent 138fb47a
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -5,35 +5,15 @@ namespace Drupal\checklistapi\Commands;
use Consolidation\OutputFormatters\FormatterManager;
use Consolidation\OutputFormatters\Options\FormatterOptions;
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Render\Element;
use Drupal\user\Entity\User;
use Drush\Commands\DrushCommands;
use Drush\Commands\help\ListCommands;
use Psr\Log\LoggerAwareInterface;

/**
 * Checklist API Drush command fileA Drush commandfile.
 */
class ChecklistapiCommands extends DrushCommands implements LoggerAwareInterface {


  /**
   * The logger channel.
   *
   * @var \Drupal\Core\Logger\LoggerChannelInterface
   */
  protected $logger;

  /**
   * Constructs an instance.
   *
   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_channel
   *   The logger channel factory.
   */
  public function __construct(LoggerChannelFactoryInterface $logger_channel) {
    $this->logger = $logger_channel->get('drush');
  }
class ChecklistapiCommands extends DrushCommands {

  /**
   * Get an overview of your installed checklists with progress details.
@@ -45,7 +25,7 @@ class ChecklistapiCommands extends DrushCommands implements LoggerAwareInterface
    $definitions = checklistapi_get_checklist_info();

    if (empty($definitions)) {
      return $this->logger->alert(dt('No checklists available.'));
      return $this->logger()->alert(dt('No checklists available.'));
    }

    // Build table rows.
@@ -102,7 +82,7 @@ class ChecklistapiCommands extends DrushCommands implements LoggerAwareInterface

    // Make sure the given checklist exists.
    if (!$checklist) {
      return $this->logger->error(dt('No such checklist "@id".', [
      return $this->logger()->error(dt('No such checklist "@id".', [
        '@id' => $checklist_id,
      ]));
    }