简体   繁体   中英

React Native collect logs remote

I want to log errors from catch statements, like

try {
  ...
} catch (error) {
  logError(error);
}

or

...
.then()
.catch (error) {
  logError(error);
}

I've tried to use https://appcenter.ms analytics for this purpose like this

import Analytics from 'appcenter-analytics';

export const logError = (error) => {
  const date = new Date();
  const properties = { error: `${date} ${error.message}`, stacktrace: `${date} ${error.stack}` };
  if (error && error.response && error.response.data) {
    properties.response = `${date} ${error.response.data.toString()}`;
  }
  Analytics.trackEvent('Error', properties);
};

But app center shows me only the top 10 repeated events, which is not really useful for me.

Are there any common practices and solutions for such purpose? The only service I've found from my searches is https://bugfender.com/ .

I started using Bugfender and find it quite nice. I think I'll keep collecting all solutions I'll find in this answer

  1. Bugfender
  2. Bugsnag
  3. Sentry

还有Sentry似乎比 Bugfender 便宜。

Also, there is NewRelic . Their implementation is not as straightforward IMO as that of Sentry or others (if you are using react-native to build your app), but their dashboards and the information and KPIs they are collecting is pretty impressive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM