question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

being able to enable/disable debug programmatically

See original GitHub issue

Wouldn’t be useful to be able to enable and disable debug mode programmatically from node scripts?

debug.enable()
debug.disable()

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
roccomusocommented, May 18, 2016

I don’t know if we mean the same thing. Actually I did something like that:

// enable
process.env.DEBUG = '*'; 
var debug = require('debug')('namespace');
debug('printed');

// disable
delete process.env.DEBUG;
var debug = require('debug')('namespace');
debug('not printed');
2reactions
ernie58commented, May 18, 2016

You can work around it like this:

require('debug').enable('myapp:somenamespace'); //enable namespace
debug = require('debug')('myapp:somenamespace'); //reload debug
Read more comments on GitHub >

github_iconTop Results From Across the Web

being able to enable/disable debug programmatically #275
Generally speaking, the debug modules will not work if you do not use a DEBUG envroinment variable. Correct me if I'm wrong.
Read more >
Can we programatically enable/disable USB debugging on ...
Hi this is my first post on here, and normally I wouldn't bother but I see no one wanted to give you the...
Read more >
Is there a way to programmatically enable/disable logging ...
I really like the ability to click the "debug" and be taken directly to the device. For me I see that the Echo...
Read more >
Solved: Enable/Disable JTAG connection programmatically
We are using the PSOC 6 - CY8C63x7 Architecture. We found on it's technical reference manual an possible option to switch on and...
Read more >
Set Breakpoints - MATLAB & Simulink
To disable this option: From the Home tab, in the Environment section, click Preferences. In the Preferences window, select MATLAB > Editor/Debugger.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found