-
Notifications
You must be signed in to change notification settings - Fork 945
Can't set global log()
function overriding namespaces ones
#873
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
Comments
Yes but
This works for me on the latest version. Can you reproduce that locally? |
It's not the same case here, that works because Lines 254 to 272 in c0805cc
With |
How can I help you with that? It's tagged as |
I'm not sure what you want. If you specify a logger on individual debug instances, of course it will override the global logger. That's well defined. What behavior would you like to see happen? |
According to the docs example, if you define a logger in debug instance, it will override all the ones from its parent debug instances, but if you define a global logger, it will override all the debug instances. The example in the docs is very explicit about this behaviour: Lines 254 to 272 in c0805cc
|
You're right, GitHub has a scrollbar on mobile and I missed it in your other comment. My apologies. PR welcome to fix the docs. There isn't a great way to fix this that won't break a bunch of people unfortunately. I need to think about how to approach this for v5. |
Thing is, it seems like this was the previous behaviour, but can't find the actual reference. |
This comment was marked as spam.
This comment was marked as spam.
2.6.8 |
4.3.4 |
On the example located at https://github.com/debug-js/debug#output-streams, it shows that's possible to set custom
log()
functions for each namespace, but also that setting it directly on thedebug
module takes precedence and will be used instead of the namespace ones. This is specially useful in my use case, since I want to capture Mediasoup debuging Logger and redirect it to Moleculer logger. Problem is that according todebug/src/common.js
Lines 112 to 113 in c0805cc
log()
function has absolute priority, so it's not possible to do it globally, and it's not possible to directly bind on top of Mediasoup Loggers since they are private, so I'm in an end road.Since the linken example at https://github.com/debug-js/debug/blob/master/examples/node/stdout.js doesn't exists too, I'm not sure if the documentation is outdated or wrong, or if setting
debug.log()
should effectively override per-namespacelog()
function and this is in fact a bug. Besides fixing this one way or another, how can I solve my problem of redirect Mediasoup log messages to Moleculer?The text was updated successfully, but these errors were encountered: