Javascript 如何在react native中将用户ID传递给sentry?

Javascript 如何在react native中将用户ID传递给sentry?,javascript,react-native,logging,sentry,react-native-sentry,Javascript,React Native,Logging,Sentry,React Native Sentry,到目前为止,我们向哨兵发送错误的方式有两种: 所有的错误都被哨兵抓住了 我们的组件使用captureException 我们希望将用户ID传递给sentry,它存储在AuthContext中,可以使用react钩子读取 我如何重新配置哨兵以传入此信息 我应该使用: Sentry.setExtra(“userId”,userId) Sentry.withScope((scope)=>{scope.setExtra(“userId”,userId);}) Sentry.configureScope

到目前为止,我们向哨兵发送错误的方式有两种:

  • 所有的
    错误
    都被哨兵抓住了
  • 我们的
    组件使用
    captureException
  • 我们希望将
    用户ID
    传递给sentry,它存储在
    AuthContext
    中,可以使用react钩子读取

    我如何重新配置哨兵以传入此信息

    我应该使用:

    • Sentry.setExtra(“userId”,userId)
    • Sentry.withScope((scope)=>{scope.setExtra(“userId”,userId);})
    • Sentry.configureScope(scope=>{scope.setExtra(“userId”,userId);})
    我关心react流,我只需要在用户登录时配置它一次(如果用户注销,我们将保留旧id)

    如何根据我的要求正确配置哨兵