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

console: timeEnd printf-like support #3613

Closed
wants to merge 1 commit into from

Conversation

fredericosilva
Copy link
Contributor

Hello,

I've made a small patch to allow us to use format on timeEnd.

console.time('Found %d places');
console.timeEnd('Found %d places', 2);

> Found 2 places: 262.450ms

console.time('Found %d places and %d faces');
console.timeEnd('Found %d places and %d faces', 2, 5);

> Found 2 places and 5 faces: 801.239ms

It's useful to profile and log at the same time.

What do you guys think about it?

@mscdex mscdex added the console Issues and PRs related to the console subsystem. label Oct 31, 2015
@Trott
Copy link
Member

Trott commented Oct 31, 2015

My opinion only, but it's probably not a good long-term plan to extend console in ways that make it incompatible with the browser. There are at least two pitfalls:

  • Right now, if you cut and paste a console.time()/console.timeEnd() pair from Node into the browser (or if you are using browserify or something similar to run Node code in the browser), it will work. If we extend those functions in ways that don't work in the browser, then that's not necessarily true anymore.
  • If Node extends console.timeEnd() and then, at a later date, browsers extend console.timeEnd() in an incompatible way, then we have a difficult choice to make: Break everyone's existing Node code to be compatible with browsers, or have an implementation that fails to align with browsers.

@ChALkeR ChALkeR added the semver-minor PRs that contain new features and should be released in the next minor version. label Oct 31, 2015
@ChALkeR
Copy link
Member

ChALkeR commented Oct 31, 2015

-1 until this either becomes documented in a standard or gets implemented in at least 2 major browser engines.

@targos
Copy link
Member

targos commented Oct 31, 2015

Also -1 from me, for the same reasons. A userland module can easily provide this functionality (and more!).

@fredericosilva
Copy link
Contributor Author

Also -1 after your feedback. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
console Issues and PRs related to the console subsystem. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants