npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@react-native-retu/bugly

v0.1.5

Published

tencent bugly

Downloads

20

Readme

@react-native-retu/bugly

NPM Version npm total downloads npm monthly downloads npm weekly downloads License

基于腾讯bugly SDK v4.0.4 实现,应用崩溃日志收集,让BUG🐛有迹可循。

🔨Debug环境下崩溃日志不会上报,请安装release版本测试!!!⚡

Installation

Using npm:

npm install --save @react-native-retu/bugly

or using yarn:

yarn add @react-native-retu/bugly

参数配置

Android

  • 在AndroidManifest.xml中添加权限:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  • 请避免混淆Bugly,在Proguard混淆文件中增加以下配置:
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}

iOS

--

Usage

import Bugly from "@react-native-retu/bugly";

componentDidMount() {
    // 征得用户同意上传崩溃日志
    ......
    // 初始化Bugly
    const strategy: BuglyStrategyConfig = {
        appChannel: "Google Play",
        appVersion: "1.0.0",
        appPackageName: "com.retu.example",
        deviceId: "983DFBBD-D047-4C53-908F",
        deviceModel: "XiaoMi 12",
    };
    Bugly.init("you appId", strategy);
}

// test crash
Bugly.testCrash();

Example

git clone https://github.com/DengXiangHong/react-native-retu-bugly.git
cd example && yarn install

android

yarn android

ios

pod install
yarn ios

API

|Method|Return Type|iOS|Android| |------|-----------|:---:|:-----:| | testCrash() | void | ✅ | ✅ | | init(appId: string, strategy: BuglyStrategyConfig) | Promise<boolean> | ✅ | ✅ | | setUserId(userId: string) | void | ✅ | ✅ | | setDeviceId(deviceId: string)| void | ❌ | ✅ | | setDeviceModel(deviceModel: string)| void | ❌ | ✅ | | setAppChannel(appChannel: string)| void | ❌ | ✅ | | setAppVersion(appVersion: string)| void | ✅ | ✅ | | setAppPackage(appPackage: string)| void | ❌ | ✅ | | setAllThreadStackEnable(crashEnable: boolean, anrEnable: boolean)| void | ❌ | ✅ | | setUserSceneTag(id: number)| void | ✅ | ✅ | | putUserData(key: string, value: string)| void | ✅ | ✅ | | log(tag: string, log: string, level: LOG_LEVEL)| void | ✅ | ✅ | | postException(params: ExceptionParams)| Promise<boolean> | ✅ | ✅ |


testCrash()

// 崩溃测试
Bugly.testCrash();

init()

// 初始化Bugly
const strategy: BuglyStrategyConfig = {
    appChannel: "Google Play",
    appVersion: "1.0.0",
    appPackageName: "com.retu.example",
    deviceId: "983DFBBD-D047-4C53-908F",
    deviceModel: "XiaoMi 12",
};
Bugly.init("you appId", strategy).then((isInit) => {
    console.log("Bugly init "+ isInit);
}).cache(error => console.error(error));

setUserId()

Bugly.setUserId("100");

setDeviceId()

// 重置设备型号,将覆盖BuglyStrategy中的值
Bugly.setDeviceId("983DFBBD-D047-4C53-908F");

setDeviceModel()

// 重置app渠道,将覆盖BuglyStrategy中的值
Bugly.setAppChannel("Google Play");

setAppVersion()

// 重置app版本,将覆盖BuglyStrategy中的值
Bugly.setAppVersion("1.0.1");

setAppPackage()

// 重置app包名,将覆盖BuglyStrategy中的值
Bugly.setAppPackage("com.retu.test");

setAllThreadStackEnable()

// 设置crash和anr时是否获取全部堆栈
Bugly.setAllThreadStackEnable(true, false);

setUserSceneTag()

// 设置标签
Bugly.setUserSceneTag(145);

putUserData()

// 自定义Map参数可以保存发生Crash时的一些自定义的环境信息。
Bugly.putUserData("userId", "120");

log()

// 该日志将在Logcat输出,并在发生异常时上报
Bugly.log("[Test]", "log test !", LOG_LEVEL.D);

postException()

// 上报自定义异常
const exception: ExceptionParams = {
    category: Platform.select({ ios: CATEGORY.IOS_JS, default: CATEGORY.ANDROID_JS }),
    errorType: 'React Native Exception Test',
    errorMsg: 'This React Native Exception Test',
    stack: 'This Test,This Test,This Test!!!',
};
Bugly.log('崩溃警告', '这是主动上报自定义崩溃', LOG_LEVEL.W);
Bugly.postException(exception).then(() => Alert.alert("上报成功", JSON.stringify(exception))).catch();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library