open-index/open-npm huggingface dataset:
npm package: @nuskin/mobile-logging
Description: - This package will allow you to add custom logging in your React Native mobile application and send   these logs to Splunk and Firebase all at once.
Author: Pooja Singh
Latest version: 3.1.3

# Mobile Logger Package

- This package will allow you to add custom logging in your React Native mobile application and send
  these logs to Splunk and Firebase all at once.

## Install and setup

- In a terminal, cd into the apps/{project-name} directory and run `yarn add @nuskin/mobile-logging`.

- Locate the top-level file `index.js`, insert the following code, replacing SPLUNK_RUM_REALM with actual Splunk REALM value, SPLUNK_RUM_ACCESS_TOKEN with actual Splunk Access Token, SPLUNK_APPLICATION_NAME with actual value of Splunk application name, SPLUNK_ENVIRONMENT with the app environment (ex: test, prod).

```
import { initSplunkLogger } from '@ns/mobile-logging';
//
/* INSERT BELOW
        initSplunkLogger(
          SPLUNK_RUM_REALM,
          SPLUNK_RUM_ACCESS_TOKEN,
          SPLUNK_APPLICATION_NAME,
          SPLUNK_ENVIRONMENT,
          buildVersion
        );
*/
//
AppRegistry.registerComponent(appName, () => App);
```

#### IMPORTANT INFORMATION:

- Please note that this package will send information to Firebase ONLY if you have already
  setup React Native Firebase for your app according to the instructions under 'Getting Started' here:
  https://rnfirebase.io/
- This package has a peer dependency for @splunk/otel-react-native and @react-native-firebase/analytics and @react-native-firebase/crashlytics. Make sure the app versions of these packages match those in this package or you will encounter issues.

## Usage

- Anywhere within your app you would like to add logging, be sure to import `Logger` from `@nuskin/mobile-logging`

```
import { Logger } from '@nuskin/mobile-logging';
```

- Use the following labels to indicate the kind of log being put in (note the colors listed - console will use these colors when logging output):

  - Debug (logs locally)
    - Accepts params `message` (string - required) and `context` (object - optional)
    - White/Default Terminal
  - Info (logs locally)
    - Accepts params `message` (string - required) and `context` (object - optional)
    - Cyan
  - Warning (will be pushed to Splunk and Firebase)
    - Accepts params `message` (string - required) and `context` (object - optional)
    - Yellow
  - Error (logs locally and will be pushed to Splunk and Firebase Crashlytics)
    - Accepts params `message` (string - required), `component` (string - required), `error` (error - required), `context` (object - optional)
    - Red
  - Event (Will be pushed to Splunk and Firebase ONLY)
    - Accepts params `event` (string - required), `component` (string - optional), `context` (object - optional)

- then add the logging as follows ():

```
Logger.<log-type>(params);
```

#### Example Usage:

```
Logger.error('Third party resource failed to return data', 'Home.tsx', error, {
    market: 'US',
    productId: 'us12345'
});
```

#### Example Output: