我已经升级到现在使用visionmedia/debug的 socket.io 1.0
它甚至在之后显示这些消息SET DEBUG=-*
You can set the log level when configuring socket.io (version < .1.0).
Setting it to 0 will only outpout in the console on error. You could also use your own logger and have it disabled.
log level defaults to 3
The amount of detail that the server should output to the logger.
0 - error
1 - warn
2 - info
3 - debug
Socket.io 1.0+
Note that the logger confirmation has changed please see the log differences and it is now using the debug module.
您可以按照文档中的说明设置日志级别。
io = require('socket.io').listen(app);
io.set('log level',0);
- 0 - 错误
- 1 - 警告
- 2 - 信息
- 3 - 调试
在里面打开socket.io文件夹
单击并打开 manager.js
function Manager (server, options) {
this.server = server;
this.namespaces = {};
this.sockets = this.of('');
this.settings = {
origins: '*:*',
log: false,
store: new MemoryStore,
logger: new Logger,
static: new Static(this),
heartbeats: true,
resource: '/socket.io',
transports: defaultTransports,
authorization: false,
blacklist: ['disconnect'],
'log level': 1,
'log colors': tty.isatty(process.stdout.fd)
};
将日志设置为假
Buzinga 完成 :-)