Reroute logging of an npm package that uses debug to a different logging function

Open
#914 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js
Domain
observability

Research direction

Start by reading the debug package's public logging behavior and the linked socket.io issue #4482, including the described attempts to redirect output. Determine whether an external logging hook can be supported; done means establishing a clear, documented way to send debug output somewhere other than console.log.

Written by the indexing model from the issue text.

Description

I am using socket.io, which in turn uses debug for its logging needs. While it's nice that that means I can easily turn on/off logging via an environment variable, I am a bit stumped on how to get it to log to anywhere else but console.log. I am describing my use case (and what I tried and failed to do) here: https://github.com/socketio/socket.io/issues/4482

While this might in the end be a problem that has to somehow be solved in the socket.io package, I wanted to ask here too, in case there is any easy way to do this myself from the outside.

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from debug-js/debug

All issues in debug-js/debug

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.