Skip to content
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

Move console to console.ts and better stringify #141

Closed
wants to merge 9 commits into from

Conversation

kevinkassimo
Copy link
Contributor

@kevinkassimo kevinkassimo commented Jun 5, 2018

Moving console definition to own file console.ts and make it a class.
Replaced JSON.stringify() with custom stringify() to avoid crashing on circular objects and work with methods/functions by displaying [Function].
Add some aliases to already implemented console methods.

@CLAassistant
Copy link

CLAassistant commented Jun 5, 2018

CLA assistant check
All committers have signed the CLA.

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.

Hey thanks. I'm generally in favor of breaking the console code into a separate file. But there should be two commits - one moving existing code over and another adding the non-circular stuff. I've made some comments below.

console.ts Outdated

const _print = V8Worker2.print;

export class DConsole {
Copy link
Member

Choose a reason for hiding this comment

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

What does D stand for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it to suppress a warning of my editor. Should have removed it, will do right away

console.ts Outdated
return out.join(" ");
}

const _print = V8Worker2.print;
Copy link
Member

Choose a reason for hiding this comment

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

The underscore is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above (seems to be considered as print in browser)

console.ts Outdated

debug = this.log;
info = this.log;
dirxml = this.log;
Copy link
Member

Choose a reason for hiding this comment

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

What's dirxml?

console.ts Outdated
@@ -0,0 +1,82 @@
class ConsoleContext {
Copy link
Member

Choose a reason for hiding this comment

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

why not
type ConsoleContext = Set<any>;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not quite sure if there would be any more fields added to the ConsoleContext, so I left it that way so could later introduce new props if necessary. Could change to type though

@kevinkassimo
Copy link
Contributor Author

kevinkassimo commented Jun 5, 2018

Thanks. Completed splitting the original commits to multiple, removing console.dirxml, changing ConsoleContext.

@kevinkassimo
Copy link
Contributor Author

Improved log format of functions, symbols, and class instances.

@kevinkassimo
Copy link
Contributor Author

@ry Noticed that this PR has been held for quite a while. I can probably close it if it is not important for now

@ry
Copy link
Member

ry commented Jun 11, 2018

@kevinkassimo Will get to it tomorrow - sorry for the delay!

@ry
Copy link
Member

ry commented Jun 11, 2018

@kevinkassimo Thank you! It's a real improvement to the code base. And apologies again for slow response.
Tweaked slightly, squashed, rebased and landed in 9365483

@ry ry closed this Jun 11, 2018
piscisaureus pushed a commit to piscisaureus/deno that referenced this pull request Oct 7, 2019
@kevinkassimo kevinkassimo deleted the feat-consoles branch December 27, 2019 07:50
hardfist pushed a commit to hardfist/deno that referenced this pull request Aug 7, 2024
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.

3 participants