Skip to content

Latest commit

 

History

History

nightingale-app-react-native

nightingale-app-react-native

React Native and Expo logger for application

Install

npm install --save nightingale-app-react-native

Usage

import { appLogger } from "nightingale-app-react-native";

appLogger.info("hello");

Create children

const myServiceLogger = appLogger.child("services:myService");
myServiceLogger.debug("started");

The Logger class

See the Logger API, with all the methods you call to log things.

Library

If you're writing a library, use only nightingale-logger

Change default levels

You can override the config using configure:

import {
  configure,
  ReactNativeConsoleHandler,
  Level,
} from "nightingale-app-react-native";

configure(
  process.env.NODE_ENV === "production"
    ? []
    : [
        {
          pattern: /^app(:|$)/,
          handlers: [new ReactNativeConsoleHandler(Level.DEBUG)],
          stop: true,
        },
        {
          handlers: [new ReactNativeConsoleHandler(Level.INFO)],
        },
      ],
);

Use source maps to display error stack trace