8000 Implement console.trace() by kevinkassimo · Pull Request #2780 · denoland/deno · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement console.trace() #2780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2019
Merged

Implement console.trace() #2780

merged 3 commits into from
Aug 17, 2019

Conversation

kevinkassimo
Copy link
Contributor

Noticed that we have never implemented this.
https://console.spec.whatwg.org/#trace

js/console.ts Outdated
const message = stringifyArgs(args, {
indentLevel: this.indentLevel,
collapsedAt: this.collapsedAt,
noTrailingNewline: true
Copy link
Member
@ry ry Aug 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is noTrailingNewline necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just that without this settings there will be a newline appended to message by stringifyArgs and thus leaving a blank line between message and trace on printing err.stack.

(There is definitely no specification saying this is not allow, just I feel it would be kind of ugly...)

Copy link
Member
@ry ry Aug 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate it being formatted as you have it.
Rather, I'm suggesting that instead of adding noTrailingNewline, you make it so stringifyArgs doesn't add a trailing \n and lift that into the existing callers.

Copy link
Contributor Author
@kevinkassimo kevinkassimo Aug 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the structure of console.ts and realized that there are some complexity introduced by console.groupCollapsed(). I believe the original intention of introducing it was to allow synchronous write to stdout, which is available now since we added File::writeSync.

Technically console.groupCollapsed() behavior we have is non-standard, as the definition of being collapsed refers to something like a dropdown. Node simply aliases groupCollapsed to group

If we were to make console.groupCollapsed to alias console.group, then things could simplify quite a bit.

kevinkassimo and others added 2 commits August 14, 2019 22:35
… out of stringifyArgs, fix console.dir, add tests, and fix a repl log quirk

For repl logging quirks, I believe we should not indent repl logging. If
we really want such indentation, we probably also want to indent "> "
prompts.
Copy link
Member
@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nice clean up with this added feature.

@ry ry merged commit 9acb177 into denoland:master Aug 17, 2019
@kevinkassimo kevinkassimo deleted the console/trace branch December 27, 2019 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0