Library which provides some tools to help logging and handle crashes
Find a file
2022-05-12 09:35:16 +02:00
.github/ISSUE_TEMPLATE Update issue templates 2020-03-05 09:05:43 +01:00
src add reactotron as a logger 2022-03-24 10:13:44 +01:00
.gitattributes init repo with reactotron 2020-02-24 11:12:27 +01:00
.gitignore improvements (#1) 2020-04-16 09:10:32 +02:00
.npmignore improvements (#1) 2020-04-16 09:10:32 +02:00
.prettierrc.js create architecture to add/remove supported library easily + can init & send log event to Firebase and Sentry 2020-03-04 21:01:12 +01:00
.travis.yml Bug fixes & improvements (#15) 2020-08-16 13:33:13 +02:00
babel.config.js init repo with reactotron 2020-02-24 11:12:27 +01:00
CHANGELOG.md Update Tealium initialisation to v2 TealiumConfig properties (#19) 2021-03-03 13:30:07 +01:00
CONTRIBUTING.md improvements (#1) 2020-04-16 09:10:32 +02:00
index.d.ts add reactotron as a logger 2022-03-24 10:13:44 +01:00
jest.setup.ts Implement flipper pluggin (#14) 2020-08-08 13:51:33 +02:00
LICENSE Create LICENSE 2020-06-09 11:01:56 +02:00
package.json fix: upgrade @types/jest from 25.2.1 to 25.2.3 (#20) 2021-05-12 09:17:21 +02:00
README.md Update Tealium initialisation to v2 TealiumConfig properties (#19) 2021-03-03 13:30:07 +01:00
REFERENCE_API.md add reactotron as a logger 2022-03-24 10:13:44 +01:00
tsconfig.json add try catch to prevent any crash and print the error 2020-03-04 21:10:52 +01:00
tslint.json improvements (#1) 2020-04-16 09:10:32 +02:00
yarn.lock Bump lodash from 4.17.15 to 4.17.21 (#23) 2021-05-12 09:18:20 +02:00

Build Status npm GitHub

React Native Logging Tools

A react native module that lets you:

  • Connect your app to reactotron easily
  • Send logs to multiple services in one time
  • Send crash/error reports to multiple services in one time
  • Register a global error handler which will capture fatal JS exceptions and send a report to your crash reporter libraries
  • Can be plugged to Flipper to display all events sent to different service.

and all this, as easily as possible


Getting started

$ yarn add react-native-logging-tools

or

$ npm install react-native-logging-tools


Status of supported libraries

Library Supported Supported versions
@react-native-firebase/analytics >= 6.0.0
@react-native-firebase/crashlytics >= 6.0.0
@sentry/react-native >= 1.3.0
instabug-reactnative >= 9.0.0
@adobe/react-native-acpanalytics >= 1.1.6
@adobe/react-native-acpcore >= 1.2.4
tealium-react-native >= 2.0.2

Usage

Imports

To start, you have to import methods from react-native-logging-tools which will be used.

import {
  init,
  createFirebaseLogger,
  createCrashlyticsLogger,
  createSentryLogger,
  createTealiumLogger,
  createAdobeLogger,
  setupReactotron,
  logEvent,
} from 'react-native-logging-tools';

And the others external libraries to plug to react-native-logging-tools

import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
import Instabug from 'instabug-reactnative';
import analytics from '@react-native-firebase/analytics';
import crashlytics from '@react-native-firebase/crashlytics';
import * as Sentry from "@sentry/react-native";
import AsyncStorage from '@react-native-community/async-storage';
import { ACPCore } from '@adobe/react-native-acpcore';
import { addPlugin } from 'react-native-flipper';

Initialization

Before any call to react-native-logging-tools's features, you have to initialize it (eg. in your App.ts or store.ts)

init({
  config: {
    reportJSErrors: !__DEV__,
  },
  analytics: [createFirebaseLogger(analytics())],
  errorReporters: [createCrashlyticsLogger(crashlytics())],
});

Documentation and example about initialization steps can be found here.

Features

Loggers

Debug Events

You can call this function where do you want/need to send logs to each plugged libraries to analytics during the initialization step

logEvent('EVENT_NAME', { your_key: 'value', ... });
logDebugEvent('EVENT_NAME', { your_key: 'value', ... });
logWarningEvent('EVENT_NAME', { your_key: 'value', ... });
logNetworkEvent('EVENT_NAME', { your_key: 'value', ... });
logErrorEvent('EVENT_NAME', { your_key: 'value', ... });

Documentation and example about logging event can be found here.

If you use react-navigation and you want send to analytics navigation events e.g, you can add logEvent to his event handler (React-navigation docs)

Error Events

You can call this function where do you want/need to send logs to each plugged libraries to errorReporters during the initialization step

recordError('EVENT_NAME', { your_key: 'value', ... });

Documentation and example about error reporting can be found here.

Reactotron

Documentation and example about Reactotron can be found here.

JS Error handler

Documentation and example about Reactotron can be found here.

Flipper

Documentation about Flipper can be found here.