| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for working on this. I noticed that browsers also have groupCollapsed() which has the property of hiding everything entered after it unless the user manually expands the group. Due to Console's nature, I say we just make it an alias of group().
Sorry, something went wrong.
There was a problem hiding this comment.
The state should be per-Console.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed, thanks.
Sorry, something went wrong.
There was a problem hiding this comment.
This browsers this also prints whatever's passed to group:
IMO it should be something like:
Console.prototype.group = function group(...args) {
this.log(...args);
this.groupIndent++;
};(I used log() as that's supposed to be the same level of severity as group() according to https://console.spec.whatwg.org/#loglevel-severity.)
Sorry, something went wrong.
There was a problem hiding this comment.
An argument passed to console.group() gets used as a label. It's not obvious to me what the best way to distinguish labels from the rest of the output is. However, omitting it entirely is probably not the way to go, so I'll add something like this.
Sorry, something went wrong.
There was a problem hiding this comment.
OK, done. (I still need to document it.)
Sorry, something went wrong.
There was a problem hiding this comment.
Documented.
Sorry, something went wrong.
There was a problem hiding this comment.
Two spaces instead of a tab? Would look more like util.indent output.
Sorry, something went wrong.
There was a problem hiding this comment.
That's how I did it at first but figured a tab would allow people to configure the indentation without us having to add configuration in our code. You raise a good point. Consistency is good, I'll change it to two spaces.
Sorry, something went wrong.
There was a problem hiding this comment.
Changed, thanks.
Sorry, something went wrong.
There was a problem hiding this comment.
Missing common.restoreStderr()?
Sorry, something went wrong.
There was a problem hiding this comment.
Oops, yes, thanks, will fix that.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed, thanks.
Sorry, something went wrong.
|
I'm not overly in love with this approach, especially given that it's trivial to break the visual formatting using new lines. e.g. console.group(); console.log('hello\nworld')' console.groupEnd(). While I'd be quite happy to have an implementation on this, if we do something and get it wrong it would be a semver-major to fix it. Not sure what else to suggest tho |
Sorry, something went wrong.
I thought about that but figured that could be a patch-level fix or a minor-level feature enhancement at a later time if it was really necessary. I'm not sure how much this feature is going to get used, to be honest. And I suspect starting with a full-blown implementation will be riskier than starting with a minimal implementation. I'm OK with deciding that we don't actually need to implement console.group() and let it be a no-op and people can implement it in the ecosystem if they want it. I'd want there to be consensus, though, that we should close #12675 and #1716 (perhaps after documenting that it's a no-op). |
Sorry, something went wrong.
|
.groupCollapsed() added as an alias for .group(). I think this is ready for another look. |
Sorry, something went wrong.
There was a problem hiding this comment.
Code changes look fine, I'm not going to object to this landing. Would like further @nodejs/ctc input tho.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not in the CTC but this LGTM.
Sorry, something went wrong.
There was a problem hiding this comment.
Nit: kGroupIndent for consistency with the kCounts above.
Sorry, something went wrong.
There was a problem hiding this comment.
Ideally this should probably be "grouped" with kCounts above.
Sorry, something went wrong.
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. (It lacks the `label` argument to `console.group()` right now, for example. How to handle `label`, or even whether to handle it, may become a bikeshed discussion. Landing a minimal implementation first avoids the pitfall of that discussion or a similar discussion delaying the implementation indefinitely.) Refs: nodejs#12675 Fixes: nodejs#1716
|
Rebased, addressed @TimothyGu's comments, force-pushed. This could use some more @nodejs/ctc review. Seems like the right thing to do to me, but I want to make sure we have consensus on that. Otherwise, I'll go the document-that-it-doesn't-do-anything route. |
Sorry, something went wrong.
Sorry, something went wrong.
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: nodejs#14910 Fixes: nodejs#1716 Ref: nodejs#12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
@BridgeAR I think @jasnell's point is that in this implementation, this code: console.log('not indented');
console.group();
console.log('indented\nshould also be indented');...results in this output: not indented
indented
should also be indented...whereas the expected output should be: not indented
indented
should also be indentedThat said, that shortcoming was a choice. I'll create a known_issues test for the problem and also the one you pointed out too. For comparison the current output in Node.js 8.4.0: not indented
indented
should also be indented |
Sorry, something went wrong.
I'll add dont-land labels that can be removed once your fixes/improvements land. (And again, if anyone thinks this ought to be reverted instead, I'm OK with that too.) |
Sorry, something went wrong.
|
@Trott right, I forgot that util.format does not escape the strings when not passed to util.inspect. |
Sorry, something went wrong.
Sorry, something went wrong.
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: nodejs/node#14910 Fixes: nodejs/node#1716 Ref: nodejs/node#12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: nodejs/node#14910 Fixes: nodejs/node#1716 Ref: nodejs/node#12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
Is this something we want to land on v8.x? |
Sorry, something went wrong.
@MylesBorins Yes. I've removed the dont-land labels. Sorry about not doing that sooner. |
Sorry, something went wrong.
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: #14910 Fixes: #1716 Ref: #12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: #14910 Fixes: #1716 Ref: #12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: #14910 Fixes: #1716 Ref: #12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Node.js exposes `console.group()` and `console.groupEnd()` via the inspector. These functions have no apparent effect when called from Node.js without the inspector. We cannot easily hide them when Node.js is started without the inspector because we support opening the inspector during runtime via `inspector.port()`. Implement a minimal `console.group()`/`console.groupEnd()`. More sophisticated implementations are possible, but they can be done in userland and/or features can be added to this at a later time. `console.groupCollapsed()` is implemented as an alias for `console.group()`. PR-URL: #14910 Fixes: #1716 Ref: #12675 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable Changes * build: * Snapshots are now re-enabled in V8 #14875 * console: * Implement minimal `console.group()`. #14910 * deps: * upgrade libuv to 1.14.1 #14866 * update nghttp2 to v1.25.0 #14955 * dns: * Add `verbatim` option to dns.lookup(). When true, results from the DNS resolver are passed on as-is, without the reshuffling that Node.js otherwise does that puts IPv4 addresses before IPv6 addresses. #14731 * fs: * add fs.copyFile and fs.copyFileSync which allows for more efficient copying of files. #15034 * inspector: * Enable async stack traces #13870 * module: * Add support for ESM. This is currently behind the `--experimental-modules` flag and requires the .mjs extension. `node --experimental-modules index.mjs` #14369 * napi: * implement promise #14365 * os: * Add support for CIDR notation to the output of the networkInterfaces() method. #14307 * perf_hooks: * An initial implementation of the Performance Timing API for Node.js. This is the same Performance Timing API implemented by modern browsers with a number of Node.js specific properties. The User Timing mark() and measure() APIs are implemented, as is a Node.js specific flavor of the Frame Timing for measuring event loop duration. #14680 * tls: * multiple PFX in createSecureContext [#14793](#14793) * Added new collaborators: * BridgeAR – Ruben Bridgewater PR-URL: #15308
Notable Changes * build: * Snapshots are now re-enabled in V8 #14875 * console: * Implement minimal `console.group()`. #14910 * deps: * upgrade libuv to 1.14.1 #14866 * update nghttp2 to v1.25.0 #14955 * dns: * Add `verbatim` option to dns.lookup(). When true, results from the DNS resolver are passed on as-is, without the reshuffling that Node.js otherwise does that puts IPv4 addresses before IPv6 addresses. #14731 * fs: * add fs.copyFile and fs.copyFileSync which allows for more efficient copying of files. #15034 * inspector: * Enable async stack traces #13870 * module: * Add support for ESM. This is currently behind the `--experimental-modules` flag and requires the .mjs extension. `node --experimental-modules index.mjs` #14369 * napi: * implement promise #14365 * os: * Add support for CIDR notation to the output of the networkInterfaces() method. #14307 * perf_hooks: * An initial implementation of the Performance Timing API for Node.js. This is the same Performance Timing API implemented by modern browsers with a number of Node.js specific properties. The User Timing mark() and measure() APIs are implemented, as is a Node.js specific flavor of the Frame Timing for measuring event loop duration. #14680 * tls: * multiple PFX in createSecureContext [#14793](#14793) * Added new collaborators: * BridgeAR – Ruben Bridgewater PR-URL: #15308
Notable Changes * build: * Snapshots are now re-enabled in V8 nodejs#14875 * console: * Implement minimal `console.group()`. nodejs#14910 * deps: * upgrade libuv to 1.14.1 nodejs#14866 * update nghttp2 to v1.25.0 nodejs#14955 * dns: * Add `verbatim` option to dns.lookup(). When true, results from the DNS resolver are passed on as-is, without the reshuffling that Node.js otherwise does that puts IPv4 addresses before IPv6 addresses. nodejs#14731 * fs: * add fs.copyFile and fs.copyFileSync which allows for more efficient copying of files. nodejs#15034 * inspector: * Enable async stack traces nodejs#13870 * module: * Add support for ESM. This is currently behind the `--experimental-modules` flag and requires the .mjs extension. `node --experimental-modules index.mjs` nodejs#14369 * napi: * implement promise nodejs#14365 * os: * Add support for CIDR notation to the output of the networkInterfaces() method. nodejs#14307 * perf_hooks: * An initial implementation of the Performance Timing API for Node.js. This is the same Performance Timing API implemented by modern browsers with a number of Node.js specific properties. The User Timing mark() and measure() APIs are implemented, as is a Node.js specific flavor of the Frame Timing for measuring event loop duration. nodejs#14680 * tls: * multiple PFX in createSecureContext [nodejs#14793](nodejs#14793) * Added new collaborators: * BridgeAR – Ruben Bridgewater PR-URL: nodejs#15308
| Back | FazBrowse Home | New Git URL |
Node.js exposes console.group() and console.groupEnd() via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via inspector.port().
Implement a minimal console.group()/console.groupEnd(). More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time. (It lacks
the label argument to console.group() right now, for example. How to
handle label, or even whether to handle it, may become
a bikeshed discussion. Landing a minimal implementation first avoids the
pitfall of that discussion or a similar discussion delaying the
implementation indefinitely.)
Refs: #12675
Fixes: #1716
Checklist
Affected core subsystem(s)
console