You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to use custom formatters in a package I'm writing, but since the formatters live on the global debug module, they could interfere with other packages that use the same module.
Wouldn't it be better if we could attach the formatters to a specific debugger created by require('debug')('myNamespace') rather than on require('debug') itself?
The text was updated successfully, but these errors were encountered:
jedwards1211
changed the title
Feature request: apply formatters only to a given namespace (packages that use debug could clobber each others' formatters...)
Feature request: attach custom formatters only to a given namespace (packages that use debug could clobber each others' custom formatters...)
Dec 21, 2020
Not really, because debug is a debugging library, not a logging library. Lightweight code and uniformity are kind of preferred in such cases. Also, this is very much an edge case and I suspect a more proprietary solution would do you better than trying to hack on a fix to a library that really isn't built for it.
That being said, #556 is would solve your problem and is officially planned (when it will actually happen is a good question, though).
Going to close it as a duplicate for that reason :) Thanks for the suggestion though!
I guess as long as I only register formatters in my test code, it won't cause any problem in production, even though there will be more arguments than format tokens without the custom formatters registered.
Ironically my org has its own logging lib that's a bit more flexible, I'm just not in the habit of using it for public projects 🙃
I'd like to use custom formatters in a package I'm writing, but since the formatters live on the global
debug
module, they could interfere with other packages that use the same module.Wouldn't it be better if we could attach the formatters to a specific debugger created by
require('debug')('myNamespace')
rather than onrequire('debug')
itself?The text was updated successfully, but these errors were encountered: