-
Notifications
You must be signed in to change notification settings - Fork 945
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
enable()
invalidates created loggers that should be enabled
#533
Comments
Agreed, this needs to be fixed. |
I tried adding this unit test and the issue seems to be resolved. But perhaps I misunderstood the issue. describe('issues', () => {
it('#533: set enabled after creating instance', () => {
const fooBar = debug('foo:bar');
expect(fooBar.enabled).to.be.equal(false);
debug.enable('foo:*');
expect(debug.enabled('foo:bar')).to.be.equal(true);
expect(fooBar.enabled).to.be.equal(true);
});
}); |
You did. Try this: debug.enable('foo:*');
debug('foo:bar').enabled // => true
debug.enable('bar:*');
debug('bar:foo').enabled // => true
debug('foo:bar').enabled // => false :( |
Yes, that is the #425 issue. In this issue, however, the namespace enable is called with a namespace string that matches an existing instance. Same cause different problem perhaps. |
Closing in favor of #425. I'm moving the whole |
For example, let's say I have the following:
will output
If you create the debugger after calling
enable()
it works as expected. I understand thatenable()
overrides what was previously enabled, but I would expect that anything that passes the new filters would be enabled.The text was updated successfully, but these errors were encountered: