Sentry:所有控制台日志都在浏览器中显示面包屑而不是文件

时间:2021-03-02 22:13:11

标签: ionic-framework sentry

我有一个 Ionic 应用程序,在添加了 sentry-cordova 之后,我注意到我的控制台日志(在浏览器中)现在显示以下内容:

enter image description here

以前,它会命名文件和行号而不是“面包屑”,我不知道如何更改这种行为。

值得注意的是,当我将鼠标悬停在日志中的 breadcrumbs.js 上时,它引用了:@sentry/browser

1 个答案:

答案 0 :(得分:1)

这与其说是一种解决方案,不如说是一种潜在的解决方法,但它对我有用,应该适用于任何使用环境变量的人。

Sentry.init({
  dsn: "___DSN___",
  integrations: function(integrations) {
    return integrations.filter(function(integration) {
      if (!environment.production) {
        // Disables breadcrumbs unless in production mode
        return integration.name !== "Breadcrumbs"
      }
    })
  }
});
相关问题