node.js 如何从 Express 应用程序中删除调试?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6807775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:24:01  来源:igfitidea点击:

How to remove debugging from an Express app?

node.jsredisexpresssocket.io

提问by Vsplit

I would like to remove the debugging mode. I am using express, redis, socket.ioand connect-redis, but I do not know where the debugging mode comes from.

我想删除调试模式。我正在使用express, redis,socket.ioconnect-redis,但我不知道调试模式来自哪里。

Node debug

节点调试

Someone has an idea?

有人有想法吗?

回答by Alfred

Update

更新

To completely remove debugging use:

要完全删除调试使用:

var io = require('socket.io').listen(app, { log: false });

Where appis node.js http server / express etc.

appnode.js http server / express 等在哪里?



You forgot to mention you are also using socket.io. This is coming from socket.io. You can disable this by configuration:

你忘了提到你也在使用socket.io。这是来自socket.io。您可以通过配置禁用此功能:

io.set('log level', 1); // reduce logging

回答by Ito

Just configure the log level to number 1 to avoid income unnecessary messages.

只需将日志级别配置为 1 即可避免收到不必要的消息。

You can figure out more information about Socket.IO options on this link.

您可以在此链接上找到有关 Socket.IO 选项的更多信息。