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: console exposing non-implemented methods #12675

Closed
jasnell opened this issue Apr 26, 2017 · 8 comments

Comments

Projects
None yet
8 participants
@jasnell
Copy link
Member

commented Apr 26, 2017

In master, console is now exposing non-implemented methods found generally on the browser side but not currently implemented in Node.js:

james@ubuntu:~/node/node$ node -v
v7.9.0
james@ubuntu:~/node/node$ node
> console.
console.__defineGetter__      console.__defineSetter__      console.__lookupGetter__      console.__lookupSetter__      console.__proto__             console.constructor           console.hasOwnProperty
console.isPrototypeOf         console.propertyIsEnumerable  console.toLocaleString        console.toString              console.valueOf

console.assert                console.dir                   console.error                 console.info                  console.log                   console.time                  console.timeEnd
console.trace                 console.warn

console.Console               console._stderr               console._stdout               console._times

> console.
> .exit
james@ubuntu:~/node/node$ ./node -v
v8.0.0-pre
james@ubuntu:~/node/node$ ./node
> console.
console.__defineGetter__      console.__defineSetter__      console.__lookupGetter__      console.__lookupSetter__      console.__proto__             console.constructor           console.hasOwnProperty
console.isPrototypeOf         console.propertyIsEnumerable  console.toLocaleString        console.toString              console.valueOf

console.assert                console.dir                   console.error                 console.info                  console.log                   console.time                  console.timeEnd
console.trace                 console.warn

console.Console               console._ignoreErrors         console._stderr               console._stderrErrorHandler   console._stdout               console._stdoutErrorHandler   console._times
console.clear                 console.count                 console.debug                 console.dirxml                console.group                 console.groupCollapsed        console.groupEnd
console.markTimeline          console.profile               console.profileEnd            console.table                 console.timeStamp             console.timeline              console.timelineEnd

> console.

For instance, typeof console.group returns function, even tho console.group() is not implemented by Node.js at all currently. Calling these appear to be non-op:

> console.group('test')
undefined
> console.groupEnd()
undefined
>

These appear to originate from V8.

@jasnell jasnell added v8.x V8 Engine and removed v8.x labels Apr 26, 2017

@addaleax addaleax added inspector and removed V8 Engine labels Apr 26, 2017

@addaleax

This comment has been minimized.

Copy link
Member

commented Apr 26, 2017

These are inspector things, see installInspectorConsoleIfNeeded() in bootstrap_node.js. I’m not sure, what do you think Node should do about these? I would be okay with trying to provide these extra methods on Node’s own Console class.

/cc @nodejs/v8-inspector

@SimenB

This comment has been minimized.

Copy link
Member

commented Apr 26, 2017

Related? #1716

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Apr 26, 2017

@addaleax ... curious. ok. We either should be providing implementation or should not be showing them when --inspect is not being used. I'll open a PR with some basic implementations.

@hashseed

This comment has been minimized.

Copy link
Member

commented Apr 26, 2017

FYI V8 does ship with a console object now. It's implemented through the inspector though.

jasnell added a commit that referenced this issue Aug 2, 2017

console: add console.count() and console.clear()
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>

addaleax added a commit that referenced this issue Aug 7, 2017

console: add console.count() and console.clear()
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>

Trott added a commit to Trott/io.js that referenced this issue Aug 18, 2017

console: implement minimal `console.group()`
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

@Trott Trott referenced this issue Aug 18, 2017

Closed

console: implement minimal `console.group()` #14910

4 of 4 tasks complete

Trott added a commit to Trott/io.js that referenced this issue Aug 18, 2017

console: implement minimal `console.group()`
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
@Trott

This comment has been minimized.

Copy link
Member

commented Aug 18, 2017

#14910 PR for the most minimal console.group() and console.groupEnd() implementation I could muster.

Trott added a commit to Trott/io.js that referenced this issue Aug 21, 2017

console: implement minimal `console.group()`
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

Trott added a commit to Trott/io.js that referenced this issue Aug 21, 2017

console: implement minimal `console.group()`
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

Trott added a commit to Trott/io.js that referenced this issue Aug 22, 2017

console: implement minimal `console.group()`
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

Trott added a commit to Trott/io.js that referenced this issue Aug 24, 2017

console: implement minimal `console.group()`
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>

addaleax added a commit to addaleax/ayo that referenced this issue Aug 25, 2017

console: implement minimal `console.group()`
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>

addaleax added a commit to ayojs/ayo that referenced this issue Aug 28, 2017

console: implement minimal `console.group()`
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>

MylesBorins added a commit that referenced this issue Sep 10, 2017

console: implement minimal `console.group()`
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>

MylesBorins added a commit that referenced this issue Sep 11, 2017

console: implement minimal `console.group()`
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>

MylesBorins added a commit that referenced this issue Sep 11, 2017

console: implement minimal `console.group()`
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>

MylesBorins added a commit that referenced this issue Sep 12, 2017

console: implement minimal `console.group()`
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>
@bengl

This comment has been minimized.

Copy link
Member

commented Sep 20, 2017

There are still a bunch of methods that show up despite not being implemented. Would bypassing setupInspectorConsole() when --inspect/--inspect-brk aren't provided be the correct thing to do here?

There's also the case of the debugger being triggered by SIGUSR1, so maybe it makes sense to keep it there at startup in case SIGUSR1 happens. Replacing console when the signal is caught might be alright, but if anything is holding onto and using references to properties of console, then that could potentially break those use cases unless there's already some internal trickery done in Console.prototype methods to check if (1) debugging is active, and (2) this === global.console, and then in that case defer to the inspector console.

bengl added a commit to bengl/node that referenced this issue Sep 23, 2017

console: add inspector console object
Also, remove undocumented (and unusable without inspector) methods from
the global console object.

Rather than having the undocumented methods on the global console, these
methods are now available on the console.inspector object.

Fixes: nodejs#12675

bengl added a commit to bengl/node that referenced this issue Sep 23, 2017

console,doc: add inspector console object
Also, remove undocumented (and unusable without inspector) methods from
the global console object.

Rather than having the undocumented methods on the global console, these
methods are now available on the console.inspector object.

Fixes: nodejs#12675

@bengl bengl referenced this issue Sep 23, 2017

Closed

console,doc: add inspector console object #15579

4 of 4 tasks complete

bengl added a commit to bengl/node that referenced this issue Sep 24, 2017

console,doc: add inspector console object
Also, remove undocumented (and unusable without inspector) methods from
the global console object.

Rather than having the undocumented methods on the global console, these
methods are now available on the console.inspector object.

Fixes: nodejs#12675

bengl added a commit to bengl/node that referenced this issue Sep 27, 2017

console,doc: add inspector console object
Also, remove undocumented (and unusable without inspector) methods from
the global console object.

Rather than having the undocumented methods on the global console, these
methods are now available on the console.inspector object.

Fixes: nodejs#12675

MylesBorins added a commit that referenced this issue Jan 16, 2018

console: add console.count() and console.clear()
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>

MylesBorins added a commit that referenced this issue Jan 17, 2018

console: add console.count() and console.clear()
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>

MylesBorins added a commit that referenced this issue Feb 12, 2018

console: add console.count() and console.clear()
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>

MylesBorins added a commit that referenced this issue Feb 13, 2018

console: add console.count() and console.clear()
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/).

PR-URL: #12678
Ref: #12675
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
@apapirovski

This comment has been minimized.

Copy link
Member

commented Apr 12, 2018

@jasnell Should this remain open? As far as I can tell we've implemented some of these since and others have been documented as being inspector-only.

@jasnell

This comment has been minimized.

Copy link
Member Author

commented Apr 12, 2018

Should be ok to close at this point

@jasnell jasnell closed this Apr 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.