3

我已经升级到现在使用visionmedia/debug的 socket.io 1.0

http://i.imgur.com/2rKvtvm.png

它甚至在之后显示这些消息SET DEBUG=-*

4

3 回答 3

2

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.

于 2014-05-26T11:47:33.930 回答
1

您可以按照文档中的说明设置日志级别。

io  = require('socket.io').listen(app);
io.set('log level',0);
  • 0 - 错误
  • 1 - 警告
  • 2 - 信息
  • 3 - 调试
于 2014-05-26T18:49:06.607 回答
-1
  1. 转到 node_modules 文件夹
  2. 在里面打开socket.io文件夹

    在此处输入图像描述

  3. 单击并打开 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 完成 :-)

于 2017-09-19T09:33:28.157 回答