Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Manually handle/redirect output #69

Closed
walling opened this Issue · 9 comments

4 participants

@walling

It could be nice to be able to handle output manually instead of it going to stderr all the time. Example:

var debug = require('debug');

// Manually handle debug output. After this there are no output to stderr.
debug.handleOutput(function(message) {
  console.log(message.name, message.time, message.text);
});
@juliangruber

i found stderr output odd anyways, what's the reason that isn't sent to stdout?

@tj
Owner
tj commented

yea might as well be stdout, it's just sort of an old unix hack to make sure you can separate the two easily but pretty unnecessary here +1

@walling

Just to clarify, I think my use case is more broad than just changing stderr to stdout. The idea is that you can overwrite where the output goes.

@tj
Owner
tj commented

im not concerned about that part personally, debug isn't really meant to be enabled in production, but passing an optional stream would be fine

@walling

If you could parse any object that implements the write method (including writable streams like process.stdout and .stderr), I would love that.

@juliangruber

ideas:

DEBUG=stdout:express,connect
require('debug').to(process.stdout);
@walling

+1 for the the .to(...) pattern.

@TooTallNate
Owner

At this point you can override debug.log with a custom function. Does that work out for your use-case?

@TooTallNate
Owner

Definitely handled at this point by @timoxley in #108. Closing.

@TooTallNate TooTallNate closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.