-
Notifications
You must be signed in to change notification settings - Fork 942
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
debug.enable()
flushes enabled namespaces
#425
Comments
The new implementation allows full control (i.e. override of the original |
I disagree with @geonanorch slightly - I feel like In fact, the default behavior if no namespaces are passed (e.g. literally |
@Qix- I don't think that we disagree, your proposal for a reset makes plenty of sense! |
Well realistically both should be supported, I think. |
It seems this issue is a wont-fix? @Qix- @geonanorch ? In other words: the bug is a feature :) The implicit and explicit |
@mblarsen Definitely not a wontfix, it's just a breaking change and requires a lot of work. |
Related #451 |
Yeah, same thing really. The fact that In fact, I'd almost say that we get rid of |
|
But it's a redundant API call. Perhaps a better name for |
Actually, I got a use case for flushing debug. I have a mono repo with diff. modules in it. When I run unit tests it's useful to change env for each module in the tests. Then flush and enable debugging again with a diff setting:
|
Just pitching in, I have got a related problem: My NPM module (called Now when // my-module
const debugMyModule = require('debug')('my-module');
require('debug').enable('my-module');
debugMyModule('test my module'); // enabled
// my-module-dep
const debugMyDepModule = require('debug')('my-dep-module');
require('debug').enable('my-dep-module');
debugMyDepModule('test my dep module'); // enabled
debugMyModule('test my module'); // disabled Maybe the warning w.r.t. the complete DEBUG override for Or even better, as proposed here (if I understand correctly), |
Mmmm... I feel in part responsible for the present situation, I'm afraid that I had not seen the full picture when I raised #433. Looking back at all the comments and related issues, my understanding is that:
If we can agree on the above, then we could implement the following with minimal pain:
In all cases, clear documentation :-D This issue has the label "pr-welcome", I am willing to do that if |
I agree on the above. Note:
Thinking futher (if you want to):
My two cents... if you want them. |
@jehon thank you for providing feedback. I agree with you that
@Qix-, this is basically your old proposal, what do you think? If you want to make a call, someone can then start working on a PR (volunteers?...) |
Having trouble with this today: const a = DEBUG('alpha');
const b = DEBUG('beta');
DEBUG.enable('alpha');
DEBUG.enable('beta');
a('hi');
b('hi');
I'd really love a way to toggle on and off individual Or even if I could access |
@reggi yes the case is clear ;-) |
@geonanorch |
@geonanorch |
I'm quite certain they meant they wanted to confirm the work that needs to be done, not that they don't know how to make a PR. I've been neglecting this repo for a while now due to some pandemic-related stresses. I apologize. I'm quite hesitant on changing anything at the present moment because of what the v5 release might look like. If we are to change the programmatic nature of things, I think we'll keep I need to think a bit more about the best way to go about this given that v5 is going to be more or less a large rewrite. I also need to discuss some ownership matters with the other maintainers before I can say anything definitively. Apologies for the vagueness. Things go slow with such a large and sensitive project. |
@jehon as Qix surmised I raised PRs before ;-) Thanks for the intention, though (you might want to PM in such cases, which are not directly relevant to an issue) |
I'll close this when it's resolved in the new version. :) |
Hi All, @geonanorch @Qix- In version 4.3.1 of debug I have been trying to adopt the features of enable() and disable(). If I were to use the examples and add in additional printouts I can see it doesn't work.
It seems like this bug listed here is at the source of this issue. Is this the problem you are talking about? And if yes, when would this build be released because it seems like it should come out soon? |
Calling
enable
is disruptive to any enabled namespaces, which has changed in the recent minor version, caused by #409The text was updated successfully, but these errors were encountered: