【问题标题】:How to disable console logs while running reactjs + meteor application如何在运行 reactjs + meteor 应用程序时禁用控制台日志
【发布时间】:2018-11-18 12:56:10
【问题描述】:

在生产服务器上运行 Meteor + ReactJs 应用程序时,我想禁止所有控制台日志和错误语句弹出。

有什么办法吗?比如在settings.json 文件中设置一个变量之类的?

【问题讨论】:

标签: node.js reactjs mongodb meteor react-router


【解决方案1】:

最简单的方法是将console.logconsole.error 重新定义为空函数

console.log = (msg) => { };
console.error = (msg) => { };

console.log("nothing appears!");
console.error("neither here!");

【讨论】:

    猜你喜欢
    • 2018-04-02
    • 2018-02-27
    • 1970-01-01
    • 2022-10-13
    • 2019-01-30
    • 2013-02-11
    • 1970-01-01
    • 2015-03-04
    • 2013-11-05
    相关资源
    最近更新 更多