Skip to content

Improve console.group in Debug Console #34981

Closed

Description

@roblourens

image

vs

image

Can we introduce a concept like this into the debug protocol, and improve the display to support collapsible sections of logs? Do other runtimes have a concept like this?

It's now more visible when debugging vscode.

Activity

  1. added
    under-discussion
    on Sep 25, 2017
  2. auchenberg commented on Sep 25, 2017

    @auchenberg
    Contributor

    Our console for sure would gain much with simple object formatting / tree structure. Is the debug console rendering virtualized today?

  3. weinand commented on Sep 25, 2017

    @weinand
    Contributor

    The debug console is based on a tree, so this should be simple to implement.

  4. added
    debug
    feature-request
    and removed
    under-discussion
    on Sep 25, 2017
  5. weinand commented on Nov 8, 2017

    @weinand
    Contributor

    roblourens is the <Start group>/<End group> markup your adhoc invention and the DA is adding this to the stack trace or does this come from CDP?

    I was able to achieve the following with the existing DAP:

    2017-11-08_15-08-31

    So, the only issue is the array index that appears in front of the stack frames (but we could call this a feature).

    The missing link detection is an orthogonal issue that we will fix anyway.

  6. roblourens commented on Nov 8, 2017

    @roblourens
    MemberAuthor

    The markup is just something I added so the group/groupEnd calls aren't totally invisible.

    My original example isn't the best example, it's logging a single item as a one-off group. In your screenshot it looks like you're logging an array of strings, which is possible, but I don't think it's the right model for logging a group.

    • The group should be updated live as log messages are produced, where an array could only be logged once the group is closed. At least I don't think I can log an object, then change the object.
    • Groups should be expanded by default
    • They need a log location for each line
    • Nested groups should look good
    • Multiline group titles and grouped messages should look good
  7. weinand commented on Nov 8, 2017

    @weinand
    Contributor

    What are "good" examples for a dynamic group?
    What do you mean by "They need a log location for each line"?

  8. roblourens commented on Nov 8, 2017

    @roblourens
    MemberAuthor

    Code like

    console.log('foo 1');
    console.group('group 1');
    console.log('foo 2');
    console.log('foo 3');
    console.group('group 2\nmultiline group\ntitle');
    
    let i = 0;
    const interval = setInterval(() => {
        console.log('bar ' + i++);
    }, 1000);
    
    setTimeout(() => {
        console.groupEnd();
        console.log('ended group 1');
        console.groupEnd();
        console.log('ended other group');
    }, 4000)

    Looks like this in chrome devtools

    image

    By "log location" I mean the location that we added for each log last month.

  9. removed this from the Backlog milestone on Nov 14, 2017
  10. 23 remaining items

  11. isidorn commented on Feb 11, 2020

    @isidorn

    Adding this to the February milestone since it is on the plan.
    Once we have this in the debug adapter protocol I can look into the implementation.

  12. weinand commented on Feb 18, 2020

    @weinand
    Contributor

    My summary of the node.js console.group documentation:

    • console.group(one or more labels):
      Increases indentation of subsequent lines by two spaces.
      If one or more labels are provided, those are printed first without the additional indentation.
      If group is shown with a collapsable/expandable UI, it should be initially expanded.
    • console.groupCollapsed():
      Increases indentation of subsequent lines by two spaces.
      If group is shown with a collapsable/expandable UI, it should be initially collapsed.
    • console.groupEnd():
      Decreases indentation of subsequent lines by two spaces.

    My DAP proposal:

    We add an optional enum property group to the Output event with these values:

    • start: start a new group in expanded mode. Subsequent Output events are members of the group and should be shown indented. An optional output attribute becomes the name of the group and is not indented.
    • startCollapsed: start a new group in collapsed mode. Subsequent Output events are members of the group and should be shown indented (as soon as the group is expanded). An optional output attribute becomes the name of the group and is not indented.
    • end: end the current group and decreases the indentation of subsequent Output events.

    /cc Isidor Nikolic (@isidorn) roblourens Connor Peet (@connor4312)

  13. weinand commented on Feb 18, 2020

    @weinand
    Contributor

    For further discussion of the group feature in the DAP, I've create this issue.

  14. weinand commented on Feb 18, 2020

    @weinand
    Contributor

    Isidor Nikolic (@isidorn) I've added a group attribute to DAP and updated debugProtocol.d.ts in VS Code.

  15. isidorn commented on Feb 20, 2020

    @isidorn

    I have pushed support for this.

    Andre Weinand (@weinand) thanks for adding the protocol!

    Connor Peet (@connor4312) roblourens it would be very cool if the node2 or the javascript debugger could support console groups this milestone, then we could add a test plan item which uses node and not mock debug. Anyways let me know how it goes, so I prepare a test plan item in time. Thanks!

  16. connor4312 commented on Feb 20, 2020

    @connor4312
    Member

    It would be a 💪 to do in the remaining days this iteration, but the test plan could literally for Rob or I to implement and verify grouping in js-debug. Andre has written a few items like that for me in the past 🙂

  17. isidorn commented on Feb 20, 2020

    @isidorn

    Connor Peet (@connor4312) writing a test plan like that would work for me. Let's see the status on this tomorrow evening and I will update the test plan accordingly. Thanks!

  18. weinand commented on Feb 20, 2020

    @weinand
    Contributor

    Great idea to implement the protocol for js-debug as part of the test plan item ;-)

  19. locked and limited conversation to collaborators on Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debugfeature-requeston-testplan

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions