首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在React本机项目中集成哨兵不工作删除错误日志

在React本机项目中集成哨兵不工作删除错误日志
EN

Stack Overflow用户
提问于 2018-04-27 06:30:23
回答 2查看 840关注 0票数 1

我想集成哨兵工具来响应本机项目崩溃报告,下面是我的代码

代码语言:javascript
复制
import { AppRegistry } from 'react-native';
import App from './App';
import { Sentry,SentryLog } from 'react-native-sentry';
import Raven from 'raven-js';
Raven
    .config('https://****@sentry.io/1196569', {
        logLevel: SentryLog.Debug,
    })
    .install();
try {
    //doSomething(a[0])
} catch(e) {
    Raven.captureException(e)
}
AppRegistry.registerComponent('RNCrashReport', () => App);

App.js

代码语言:javascript
复制
import React, { Component } from 'react';
import {
    Platform,
    StyleSheet,
    View
} from 'react-native';

type Props = {};
export default class App extends Component<Props> {
    render() {
        return (
            <View style={styles.container}>
                <Text>{Hello}</Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
});

在我的App.js中,我并不是在react本机包中定义文本组件,所以这是一个错误,但是在我的哨兵仪表板错误中并没有删除,所以我不知道我缺少什么配置吗?

EN

回答 2

Stack Overflow用户

发布于 2018-04-27 07:12:43

我目前正在使用Sentry,但我不需要安装Raven。

我看到您一直在阅读JavaScript剖面,这就是您安装Raven的原因。但是,您应该查看反应自然剖面

我使用react-native-sentry包并安装它,只需使用:

代码语言:javascript
复制
import { Sentry } from 'react-native-sentry'

Sentry.config('key').install();
票数 0
EN

Stack Overflow用户

发布于 2019-01-28 09:57:06

配置所需的全部内容是

代码语言:javascript
复制
import { Sentry } from 'react-native-sentry';
Sentry.config(SENTRY_URL).install();

然后,您可以使用https://docs.sentry.io/clients/react-native/config/中列出的方法

若要设置您自己的键值对,请执行以下操作:

代码语言:javascript
复制
Sentry.setExtraContext({
     key: value, key: value,....
   });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50056544

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档