Skip to content

Latest commit

 

History

History
76 lines (48 loc) · 2.17 KB

LogUtils.md

File metadata and controls

76 lines (48 loc) · 2.17 KB

Log Utils

Helpers for Log that uses reactotron and crashlytics.

Extra Installation

To use the component, you need to add reactotron-react-native as a dev dependency and both @react-native-firebase/app and @react-native-firebase/crashlytics as dependencies to your project and follow the instruction for them.

Usage

import React from 'react';
import { View } from 'react-native';
import {
  configureLog,
  Button,
} from '@eslam-elmeniawy/react-native-common-components';

const MyComponent = () => {
  React.useEffect(() => {
    configureLog?.({
      appName: '@eslam-elmeniawy/react-native-common-components',
      firebaseLogLevels: ['INFO', 'LOG', 'WARN', 'ERROR'],
      isLocalLogEnable: true,
    });
  });

  const onPress = () => console.log('Log message');

  return (
    <View>
      <Button text="Log" onPress={onPress} />
    </View>
  );
};

Content

configureLog

Type: ((options?: Options) => Reactotron<ReactotronReactNative> & ReactotronReactNative) | undefined

Options.appName

Type: string

The app name to use when configuring reactotron.

Options.firebaseLogLevels

Type: Array<'INFO' | 'LOG' | 'WARN' | 'ERROR'>

Default value: []

Log levels to add to firebase crashlytics logs.

Options.isLocalLogEnable

Type: boolean

Default value: false

Whether to enable local log or not.

Options.clientOptions

Type: ClientOptions

reactotron client options.

Options.pluginCreators

Type: ((client: Reactotron<ReactotronReactNative> & ReactotronReactNative) => any)[]

List of reactotron plugin creator functions to add to add to reactotron instance.