inspector: add inspector console support for native Console#7988
inspector: add inspector console support for native Console#7988alexkozy wants to merge 1 commit intonodejs:masterfrom alexkozy:inspector-console-support
Conversation
src/node.cc
Outdated
There was a problem hiding this comment.
I would like to suggest moving this block (and 2 functions above) into inspector_agent.{h,cc} - this way there will be less conditional compilation to maintain.
|
/cc @dgozman |
|
Wouldn't it be possible to instead store copies of the original console functions, which would allow us to avoid having to modify |
|
I addressed your comments and moved all changes into inspector_agent.cc and bootstrap_node.js. |
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Let's check that arguments are functions here.
|
Addressed all comments, please take another look! |
lib/internal/bootstrap_node.js
Outdated
There was a problem hiding this comment.
Still a s/sequentally/sequentially/ typo here.
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Nit: operator should go on previous line.
|
addressed comments, please take another look. |
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Nit: arguments should line up.
|
LGTM with a suggestion and a nit. CI: https://ci.nodejs.org/job/node-test-pull-request/3559/ |
|
Thanks! All done. It looks like freebsd test failure doesn't relate to this pull request. |
|
LGTM |
lib/internal/bootstrap_node.js
Outdated
There was a problem hiding this comment.
I would prefer if inspector wasn't a public property on process (except during startup). Could you get away with deleting process.inspector here?
There was a problem hiding this comment.
I can remove process.inspector here. Done.
|
All done. Please take another look! |
|
LGTM. New CI: https://ci.nodejs.org/job/node-test-pull-request/3580/. |
lib/internal/bootstrap_node.js
Outdated
There was a problem hiding this comment.
grammar nit: "then wrap these two methods..."
There was a problem hiding this comment.
Also, "will preserve the original stack"
|
Thanks for review. |
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Would prefer the error message to be a bit more descriptive
|
LGTM with a nit |
|
Done. |
|
This time it was failed on https://ci.nodejs.org/job/node-compile-windows/3631/label=win-vs2015/console . It looks like it doesn't relate to my change, does it? |
|
That seems to be infrastructure related. Windows did pass on the previous build. I think this is good to land. I will do so tomorrow. |
When node is running with --inspect flag, default console.log, console.warn and other methods call inspector console methods in addition to current behaviour (dump formatted message to stderr and stdout). Inspector console methods forward message to DevTools and show its in DevTools Console with DevTools formatters. Inspector console methods not presented on Node console will be added into it. Only own methods on global.console object will be changed while debugging session. User still able to redefine it, use console.Console or change original methods on Console.prototype.
|
I've rebased this pull request to resolve conflicts. |
|
Thanks, landed as f6070a1. |
When node is running with --inspect flag, default console.log, console.warn and other methods call inspector console methods in addition to current behaviour (dump formatted message to stderr and stdout). Inspector console methods forward message to DevTools and show up in DevTools Console with DevTools formatters. Inspector console methods not present on Node console will be added into it. Only own methods on global.console object will be changed while in a debugging session. User are still able to redefine it, use console.Console or change original methods on Console.prototype. PR-URL: #7988 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
When node is running with --inspect flag, default console.log, console.warn and other methods call inspector console methods in addition to current behaviour (dump formatted message to stderr and stdout). Inspector console methods forward message to DevTools and show up in DevTools Console with DevTools formatters. Inspector console methods not present on Node console will be added into it. Only own methods on global.console object will be changed while in a debugging session. User are still able to redefine it, use console.Console or change original methods on Console.prototype. PR-URL: #7988 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>

Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
console
Description of change
When node is running with --inspect flag, default console.log,
console.warn and other methods call inspector console methods in
addition to current behaviour (dump formatted message to stderr
and stdout). Inspector console methods forward message to DevTools and
show its in DevTools Console with DevTools formatters. Inspector console
methods not presented on Node console will be added into it.
Only own methods on global.console object will be changed while
debugging session. User still able to redefine it, use console.Console
or change original methods on Console.prototype.