首页 > 解决方案 > 无法在 Web 检查器中禁用电容器插件日志记录

问题描述

我正在使用电容器存储来获取和设置值,如此处所示https://capacitorjs.com/docs/apis/storage 一切正常但是我在使用 xcode 模拟器和 safari web 检查器进行开发时收到大量控制台消息,每个我获取和设置值的时间:

>native Storage.get (#284123)
>native Storage.get (#284124)
>native Storage.get (#284125)
>result Storage.get (#284123)
>native Storage.get (#284126)

我的应用程序执行了数百个这样的操作。

尝试按照此处所述禁用这些日志,但仍在记录

https://github.com/ionic-team/capacitor/issues/2438

"hideLogs": true

或者

"ios": {
    "hideLogs": true
}

在电容器.config.json 中没有禁用

它甚至在官方文档中提到它,但不起作用,有什么想法吗? https://capacitorjs.com/docs/reference/config

https://capacitorjs.com/docs/apis/console

谢谢

标签: angularionic-frameworkcapacitor

解决方案


在 Capacitor 3 中,您可以使用loggingBehavior配置并将其设置为none

"loggingBehavior": "none"

推荐阅读