0

pm2 -version:0.12.1;debug -version:2.1.0

代码:

 debug("Send data to client success! length " + buf.length+" Bytes!");

pm2 日志:

[1_control-15 (err)] Tue, 16 Dec 2014 12:36:50 GMT [1_control] Client.ts Send data to client success! length 100 Bytes!

[1_control-15 (err)] Tue, 16 Dec 2014 12:36:50 GMT [1_control]n Client.ts Send data to client success! length 135 Bytes!

请帮忙。

4

3 回答 3

1

不确定问题是否仍然相关,但正如官方文档所说,您可以像这样覆盖此行为:

  var debug = require('debug');
  var error = debug('app:error');

  // by default stderr is used 
  error('goes to stderr!');

  var log = debug('app:log');
  // set this namespace to log via console.log 
  log.log = console.log.bind(console); // don't forget to bind to console! 
  log('goes to stdout');
  error('still goes to stderr!');

  // set all output to go via console.info 
  // overrides all per-namespace log settings 
  debug.log = console.info.bind(console);
  error('now goes to stdout via console.info');
  log('still goes to stdout, but via console.info now');

`

于 2017-03-13T10:42:15.903 回答
0

2.* 版本的调试模块将所有日志设置为 stderr,1.* 版本就可以了

于 2014-12-26T11:06:46.767 回答
0

设置 DEBUG_FD=1 可以将输出流更改为 process.stdout

DEBUG_FD=1 node index.js

于 2015-03-03T09:20:01.323 回答