Skip to content
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

Listing all available targets? #722

Closed
jehon opened this issue Aug 29, 2019 · 3 comments
Closed

Listing all available targets? #722

jehon opened this issue Aug 29, 2019 · 3 comments

Comments

@jehon
Copy link

jehon commented Aug 29, 2019

Hello

I would like to list all targets that are available for debug.

I would suggest a list of the strings used:

const debugFactory = require('debug');
var a = debugFactory('worker:a');
console.log(debugFactory.getAllAvailableTargets());
// result:
// [ "worker:a" ]
// or
// [ "worker", "worker:a" ]

I have read the comments of the #255, that is suggesting that it would be a memory leak. Is that so? If we cache the "keys" and not the objects, I don't think that it would be a memory leak?

I could submit a PR if this idea is accepted.

@Qix-
Copy link
Member

Qix- commented Aug 29, 2019

If this is just for debugging purposes, require('debug').names will give you the list of regexes that match the enabled namespaces.

Otherwise, this would be storing strings indefinitely, which might leak given the current implementation. #678 has more information about that, and #425 currently discusses .enable() a bit more too.

I'll consider this but right now it's not something I want to support until v5.

@jehon
Copy link
Author

jehon commented Aug 29, 2019

Thanks Qix,

I will see if I can help on the memory leak, as a first step before discussing this one :-)

I hope your house move was fine, your new job is great and your family bring you hapiness !

Have a nice day

@Qix-
Copy link
Member

Qix- commented Nov 7, 2019

Sorry for the delayed response - thank you for the kind words @jehon ^^

@Qix- Qix- closed this as completed Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants