javascript - 在 isomorphic-fetch 中禁用控制台日志

标签 javascript reactjs ecmascript-6 redux fetch

我正在使用同构-fetch https://github.com/matthew-andrews/isomorphic-fetch 每次返回响应时,无论成功还是失败,我都会看到属于调试类别的控制台日志。它从哪里来?它可以是特定于库的吗?但我在库源中找不到它。或者是关于 Fetch API 的?

最佳答案

它与 isomorphic-fetch 库无关。这是浏览器直接提供的功能(至少在 Chrome 和 Firefox 中)。

Chrome

对于您可以使用开发人员工具“控制台设置”中的Log XMLHttpRequests复选框禁用它:

https://developers.google.com/web/tools/chrome-devtools/console/#additional_settings

Open the DevTools settings, go to the General tab, and scroll down to the Console section for further Console settings. Chrome general settings

火狐浏览器

对于您在“控制台”选项卡的工具栏中具有 Net > XHR 设置:

https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Filtering_and_searching tag:Firefox Console Filtering and searching To see only messages of particular categories, click the button labeled with that category ("Net", "CSS", and so on). Clicking the main part of the button toggles that category on or off, while clicking the arrow on the right gives you more fine-grained filter options within that category:

Net
- Errors
- Warnings
- XHR
- Log
...

关于javascript - 在 isomorphic-fetch 中禁用控制台日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39742637/

相关文章:

javascript - 源映射语法 - 散列或 at 符号

reactjs - 通过自定义检查扩展 react Prop 类型验证

javascript - this.state.foo 在 _onChange 中不同,在 render() 中不同?

javascript - React - 遍历数组和事件

javascript - 如何运行 webpack 转换后的函数?

javascript - 使用 jQuery 更新数组中对象的物理位置

javascript - Datepicker getDate 方法在第二次单击时起作用并显示先前选择的日期

javascript - angular.js $destroy 事件 - 我应该手动解除绑定(bind)吗?

javascript - 如何在 native react 中有条件地渲染警报组件

javascript - 为什么生成器的 .next 需要一个 setTimeout?