bootstrap: expose process._rawDebug as a global function - #55907
bootstrap: expose process._rawDebug as a global function#55907jsumners wants to merge 6 commits into
Conversation
The `process._rawDebug` function is very helpful when triaging bugs that cross asynchronous boundaries. It is also quite cumbersome to write out `process._rawDebug` everywhere such a line is needed. So this change exposes it as a global function to facilitate an improved developer experience.
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #55907 +/- ##
==========================================
- Coverage 88.41% 87.98% -0.44%
==========================================
Files 654 653 -1
Lines 188036 187868 -168
Branches 36187 35890 -297
==========================================
- Hits 166260 165293 -967
- Misses 14989 15738 +749
- Partials 6787 6837 +50
🚀 New features to boost your workflow:
|
|
Hmmm... I'm not a big fan of adding new Node.js specific globals, and given that |
In my experience, when someone wants to use this function they are likely going to be writing it in multiple places. I hope we can agree that it is easier, and less annoying, to type out Regarding adding Node.js specific globals: isn't that the point of having a specific runtime? To be able to design it such that it provides an environment that is specific to the use cases of the developers that are using it? As an example, at least in Vivaldi and Safari, all Window properties and methods are available without needing to prefix them with |
|
|
I disagree. Node.js is a runtime for writing system applications. As such, |
|
This pull request has been marked as stale due to 90 days of inactivity. |
|
Not stale. Just being ignored. |
legendecas
left a comment
There was a problem hiding this comment.
If the purpose is to make async hooks debugging easier, a better approach is to make the already established util.debuglog immune from interleaving async hooks, rather than exposing new an internal raw debug log as a new global API.
I never mentioned "hooks". This does not add a new internal API. It surfaces an existing API to be easier to use. |
jasnell
left a comment
There was a problem hiding this comment.
I'm not a big fan of new non-standard globals but I also don't have a strong reason to object.
|
First, an internal method means, its not designed to be exposed directly. This indeed does not add a new internal method, but this internal method was only designed to be available at the very beginning of the JS world helping debug internals: $ ./node -e 'rawDebug({ hello: "world" })'
# Assertion failed: args.Length() == 1 && args[0]->IsString() && "must be called with a single string"This method crashes hard if the argument type is not expected. I strongly object exposing this method as-is as a global API. A new global API should be ergonomic to use, and well-knownly useful. We already have |
|
I don't know what that |
The
process._rawDebugfunction is very helpful when triaging bugs that cross asynchronous boundaries. It is also quite cumbersome to write outprocess._rawDebugeverywhere such a line is needed. So this change exposes it as a global function to facilitate an improveddeveloper experience.
If we think that a naming collision is possible, maybe it could be named
nodeDebugor similar.