Problem/Motivation

The current debug output from the --migrate-debug and --migrate-debug-pre options has unwanted line numbers

Steps to reproduce

  1. Install migrate_devel module
  2. Run any migration with drush migrate:import [migration_id] --migrate-debug
  3. Observe line numbers like "1^ array:5 [" and headers like $Source

Proposed resolution

Replace simple dump() calls with a custom printDebugOutput() method:

Remaining tasks

Everything

User interface changes

Before:

  1^ array:5 [
    "id" => "123"
  ]
  2^ ---------------------------------------------------------------------
  3^ |                             $Source                               |
  

After:

  ---------------------------------------------------------------------
  |                             Source                                |
  ---------------------------------------------------------------------
  array:5 [
    "id" => "123"
  ]
  

API changes

none

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

batigolix created an issue. See original summary.

batigolix’s picture

Status: Active » Needs review
arjenk’s picture

Status: Needs review » Reviewed & tested by the community
  • code looks good
  • patch applies
  • after cache clear, nicely removes all strange linenumbers, f.e.
    ---------------------------------------------------------------------
    |                       DestinationIdValues                         |
    ---------------------------------------------------------------------
    array:1 [
      0 => "2927"
    ]
    
  • minor: instead of echo(), use Drush::output()->writeln().

batigolix’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • batigolix committed a2d55eb9 on 3.x
    feat: #3563784 Improve output
    
    By: batigolix
    By: arjenk
    
jlstrecker’s picture

This also seems to have fixed a bug where the --migrate-debug was outputting HTML instead of the usual format.

(I saw the bug in migrate_devel 3.0.0 with Drupal 11.3 and Drush 13.7. When I updated to the 3.x dev branch, the bug was fixed.)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.