在反应本机应用程序中初始化 sentry.init 的位置
Where to initialize sentry.init in a react native app
在我的 React 本机应用程序中,为了跟踪错误,我将使用哨兵。那么,我到底应该在哪里使用 Sentry.init
?
我尝试在 app.ts 的 useEffect 中使用它。但是,如果在加载应用程序之前有任何错误,这些错误不会被跟踪。
我应该在哪里使用此代码才能正常使用哨兵?
Sentry.init({
dsn: SENTRY_DSN,
environment: ENVIRONMENT,
});
在我的项目中,我是这样使用的,但我遇到了所有错误(在 App 组件之前)
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://71c4b3f6a9b646c992175aa6cc095c08@o312251.ingest.sentry.io/1781718'
});
export default class App extends Component {
...
}
您正在寻找的是:
https://docs.sentry.io/platforms/react-native/manual-setup/native-init/
这将捕获在 JS 端哨兵初始化之前发生的本机崩溃
在我的 React 本机应用程序中,为了跟踪错误,我将使用哨兵。那么,我到底应该在哪里使用 Sentry.init
?
我尝试在 app.ts 的 useEffect 中使用它。但是,如果在加载应用程序之前有任何错误,这些错误不会被跟踪。
我应该在哪里使用此代码才能正常使用哨兵?
Sentry.init({
dsn: SENTRY_DSN,
environment: ENVIRONMENT,
});
在我的项目中,我是这样使用的,但我遇到了所有错误(在 App 组件之前)
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://71c4b3f6a9b646c992175aa6cc095c08@o312251.ingest.sentry.io/1781718'
});
export default class App extends Component {
...
}
您正在寻找的是: https://docs.sentry.io/platforms/react-native/manual-setup/native-init/
这将捕获在 JS 端哨兵初始化之前发生的本机崩溃