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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-logkit

v0.1.0

Published

A flexible and powerful logging toolkit for React Native apps.

Readme


📝 React Native LogKit

npm version license

A flexible, modular, and extensible logging system for React Native apps — with built-in support for performance monitoring, visual error overlays, and integrations like Sentry and Crashlytics.


✨ Features

  • 📊 Multiple log levels: DEBUG, INFO, WARN, ERROR, PERF, MID
  • 🎨 Color-coded logs in the console
  • ⚙️ Configurable output and behavior
  • 🧩 Optional integrations: Sentry, Firebase Crashlytics, custom remotes
  • 🧵 Tag-based logging for better categorization
  • 🧪 Performance tracking with hooks and utility methods
  • Lightweight core, with modular opt-in extensions

📦 Installation

npm install react-native-logkit
# o
yarn add react-native-logkit

📦 Optional dependencies

If you want to use additional integrations:

# For Sentry
npm install @sentry/react-native

# For Crashlytics (Firebase)
npm install @react-native-firebase/crashlytics

🔰 Basic Usage

import { Logger } from 'react-native-logkit';

Logger.debug('Auth', 'Login started');
Logger.info('User', 'User logged in', { id: '123' });
Logger.warn('API', 'Slow response time');
Logger.error('Network', 'Connection failed');

🔌 Integrations

✅ Enable Sentry

import { initSentryLogger } from 'react-native-logkit/integrations';

initSentryLogger();
  • Logs at ERROR level will be sent to Sentry
  • Logs at DEBUG, INFO, and WARN will be added as breadcrumbs

✅ Enable Crashlytics

import { initCrashlyticsLogger } from 'react-native-logkit/integrations';

initCrashlyticsLogger();

⏱️ Performance Tracking

With React Components

import { usePerformance } from 'react-native-logkit';

const MyComponent = () => {
  const perf = usePerformance('MyComponent');

  useEffect(() => {
    perf.start('fetchData');

    fetchData().then(() => {
      perf.end('fetchData');
    });
  }, []);

  return <Text>Hello</Text>;
};

As a Utility (non-component)

import { Perf } from 'react-native-logkit';

Perf.start('fetchData');

// Your logic...

Perf.end('fetchData');

🪝 useLogger (React Hook)

import { useLogger } from 'react-native-logkit';

const MyComponent = () => {
  const log = useLogger('MyComponent');

  useEffect(() => {
    log.info('Mounted');
  }, []);

  return <Text>...</Text>;
};

📚 API Reference

Logger Methods

Logger.debug(tag: string, ...args: any[]): void
Logger.info(tag: string, ...args: any[]): void
Logger.warn(tag: string, ...args: any[]): void
Logger.error(tag: string, ...args: any[]): void

Configuration

Logger.setLevel(LogLevel.INFO);
Logger.getLevel(); // returns current level
Logger.reset(); // resets to default

🔌 Custom Adapters

You can register adapters to handle logs in custom ways:

Logger.registerAdapter({
  key: 'customAdapter',
  log: (level, tag, message) => {
    console.log('🔄 Forwarded log:', level, tag, message);
  },
});

To avoid duplicates, adapters must have a unique key.


🧪 Log Levels

| Level | Description | |---------|--------------------------| | DEBUG | Detailed debug info | | INFO | Informational messages | | WARN | Warning conditions | | ERROR | Error conditions | | SILENT | Disable all logging | | PERF | Performance tracking | | MID | Middleware logging |


🧼 Reset / Clean Logs

Logger.reset(); // Clears adapters and resets config

📄 License

MIT © IsPriamo