[Feature] enable/disable debugging dynamically
See original GitHub issueOften when one is investigating a ‘live’ issue, one would rather not restart node to enable debugging: this might make the problem disappear until it is triggered again later. Instead debug configuration should be alterable dynamically through some kind of listener (e.g. file watch, socket –the implementation of the listener is not the purpose of this issue, though that would make a nice addition!).
Support for such dynamic changes would be easy to add in debug.js
, here the output of diff -n
for the current codebase:
a21 1
exports._debuggers = Object.create(null);
a126 1
exports._debuggers[namespace] = debug;
a155 10
for (const namespace in exports._debuggers) {
exports._debuggers[namespace].enabled = false;
exports.names.some( (pattern) => {
const match = pattern.test(namespace);
if (match) {
exports._debuggers[namespace].enabled = true;
}
return match;
});
}
With above one can change the debug settings from any place in the code using the same values as passed through the DEBUG
environment variable at initialization time:
const debugCore = require('debug');
debugCore.enable('mymod*');
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:5 (2 by maintainers)
Top Results From Across the Web
[Feature] enable/disable debugging dynamically · Issue #433
I use debug via browserify-as-a-service build(version 3.1.0) and set localStorage. What should I do to disable debug when publish on line?
Read more >Dynamic debug — The Linux Kernel documentation
Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if CONFIG_DYNAMIC_DEBUG is ...
Read more >Ways to dynamically enable/disable debug features in an APK
Key the debug features off of SharedPreference values, and expose them in a preferences/debug menu in the UI.
Read more >SM Tip: How to use dynamic debugging feature "Send Debug ...
We need to login to ServiceManager (SM) with two sessions. Session (A) with a SysAdmin user, for example falcon, to set the trace...
Read more >Enable and disable Edit and Continue - Visual Studio (Windows)
Learn how to disable and enable Edit and Continue in Visual Studio Options at design time. Edit and Continue works only in debug...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, will do! Initial feedback in the meantime:
README.md
, the feature is not documentedAll the same, thank you for considering and implementing my request 😃
@tasoss No, as that is a limitation of the operating system. You cannot change an environment variable from outside a process.