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

@nuskin/mobile-logging

v3.1.1

Published

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

Downloads

2,340

Readme

Mobile Logger Package

  • This package will allow you to add custom logging in your React Native mobile application and send these logs to DataDog 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 DD_CLIENT_TOKEN with your app's DataDog client token, CI_ENVIRONMENT_NAME with the app environment (ex: test, prod), and DD_RUM_APPLICATION_ID with your DataDog RUM App Id:

import { initLogger } from '@ns/mobile-logging';
//
// INSERT BELOW
initLogger(DD_CLIENT_TOKEN, CI_ENVIRONMENT_NAME, DD_RUM_APPLICATION_ID);
//
//
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 @datadog/mobile-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 DataDog and Firebase)
      • Accepts params message (string - required) and context (object - optional)
      • Yellow
    • Error (logs locally and will be pushed to DataDog and Firebase Crashlytics)
      • Accepts params message (string - required), component (string - required), error (error - required), context (object - optional)
      • Red
    • Event (Will be pushed to DataDog 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: