node.js - nodejs using pm2 and debug ,all the log output by the ‘debug’ module all to the stderr ,why? -
pm2 -version:0.12.1;debug -version:2.1.0
code:
debug("send data client success! length " + buf.length+" bytes!");
pm2 logs:
[1_control-15 (err)] tue, 16 dec 2014 12:36:50 gmt [1_control] client.ts send data client success! length 100 bytes! [1_control-15 (err)] tue, 16 dec 2014 12:36:50 gmt [1_control]n client.ts send data client success! length 135 bytes!
please help.
not sure if question still relevant, official documentation says, can override behavior this:
var debug = require('debug'); var error = debug('app:error'); // default stderr used error('goes stderr!'); var log = debug('app:log'); // set namespace log via console.log log.log = console.log.bind(console); // don't forget bind console! log('goes stdout'); error('still goes stderr!'); // set output go via console.info // overrides per-namespace log settings debug.log = console.info.bind(console); error('now goes stdout via console.info'); log('still goes stdout, via console.info now');
`
Comments
Post a Comment