我正在使用同构-fetch https://github.com/matthew-andrews/isomorphic-fetch 每次返回响应时,无论成功还是失败,我都会看到属于调试类别的控制台日志。它从哪里来?它可以是特定于库的吗?但我在库源中找不到它。或者是关于 Fetch API 的?
最佳答案
它与 isomorphic-fetch 库无关。这是浏览器直接提供的功能(至少在 Chrome 和 Firefox 中)。
Chrome
对于google-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.
火狐浏览器
对于firefox您在“控制台”选项卡的工具栏中具有 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 ...
关于javascript - 在 isomorphic-fetch 中禁用控制台日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39742637/