Can't set global `log()` function overriding namespaces ones
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, nodejs
- Domain
- tooling
Research direction
Start by comparing the output-streams documentation with src/common.js around lines 112-113 and the referenced examples/node/stdout.js path. Determine whether the documented precedence and example are consistent, then add or update coverage for the chosen behavior and verify the documentation explains how global and namespace log functions interact.
Written by the indexing model from the issue text.
Description
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 the debug 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 to https://github.com/debug-js/debug/blob/c0805cc4d3b2c7c987567e99ecaec78840516d7b/src/common.js#L112-L113 namespaces 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-namespace log() 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?
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 992
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from debug-js/debug
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Debug as JSON Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·