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

Disable console logs in isomorphic-fetch

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

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

Chrome

对于 ,您可以使用开发人员工具中的 Log XMLHttpRequests 复选框禁用它 "Console Setting":

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.

火狐

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

https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#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
...