[RFC] Pluggable log handler
See original GitHub issueWould you consider a PR that implemented support for globally defaulting log
to something other than process.stderr
? The way I’d expect this to work is debug would default to stderr unless process[Symbol.for(‘DEBUG_LOG’)]
was set. Of course the local self.log
would always take precedence.
The motivation for this feature is to allow an application to redirect all debug output to a logger of its choice, without knowing which all dependencies utilize debug.
I’ve chosen a global Symbol to circumvent the issue of multiple versions of debug in codebase.
Happy to submit this. Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:22 (11 by maintainers)
Top Results From Across the Web
RFC 3838 OPES Policy Requirements August 2004
Policy, Authorization, and Enforcement Requirements of the Open Pluggable Edge Services (OPES) (RFC 3838, August 2004)
Read more >[RFC] Compatibility layer · Issue #644 · debug-js/debug · GitHub
I do like the idea of making debug more like SLF4J, where the user could write logging handlers and load them in using...
Read more >RFC 7574: Peer-to-Peer Streaming Peer Protocol (PPSPP)
Let's call this protocol handler Peer A. Peer A parses the URL to ... As a result, every single chunk is acknowledged a...
Read more >Pluggable Backend - ForgeRock Backstage
This is an abstract object type that cannot be instantiated. A Pluggable Backend stores application data in a pluggable database. Pluggable Backends. The ......
Read more >Hudi - Confluence Mobile - Apache Software Foundation
RFCs are the way to propose large changes to Hudi and the RFC Process details how to go about ... RFC - 39...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It might be much more practical to just have a top level function on the
debug
instance. However, it’s usually an anti-pattern to modify a package’s state in a way that affects other packages.EventEmitter
s are a good candidate here, too.Doing a bit of poking around on this today, this appears to be soft-blocked by nodejs/node#40110. Not a deal-breaker but it’ll be less than advantageous without allowing users to do this with ESM modules.
The other issue is code-based linkage. If you add a handler via code instead of pre-loading modules, then we’ll run into the issue of libraries pre-loading their own handlers and causing unexpected output or mis-routed output (potentially) - something that, given the ubiquity of this package, simply won’t do.
There needs to be a way to either prevent or disable added log handlers in application code.