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 🙏

© 2026 – Pkg Stats / Ryan Hefner

insight-log-agent

v1.1.1

Published

Universal console logging library that sends logs to remote server for Node.js, ReactJS, and React Native

Readme

Insight Log Agent

Universal logging library that overrides console.log to send logs to a remote server, available for multiple frameworks with explicit platform selection.

🚀 Installation from GitHub

# Direct installation from GitHub
npm install github:yourusername/insight-log-agent

# Or using the complete URL
npm install https://github.com/yourusername/insight-log-agent.git

# Specifying specific branch
npm install github:yourusername/insight-log-agent#main

📁 Repository Structure

insight-log-agent/
├── index.js              # Main entry point (auto-detection)
├── index.esm.js          # ESM version
├── index.d.ts            # TypeScript definitions
├── nodejs/               # Node.js implementation
├── reactjs/              # ReactJS implementation
├── react-native/         # React Native implementation
├── package.json          # NPM configuration
└── README.md             # This file

🎯 Supported Frameworks

  • Node.js - Server-side applications
  • ReactJS - React web applications
  • React Native - React Native mobile applications
  • Explicit Selection - You must explicitly choose your platform implementation

📋 Main Features

  • Non-intrusive override - Maintains original console functionality
  • Automatic stack trace - Automatically identifies file and line of code
  • Fault tolerant - Never breaks the application, fails silently
  • Automatic TraceID - Log tracking across microservices
  • Flexible configuration - Customizable parameters per log
  • Multiple levels - INFO, ERROR, WARNING, DEBUG
  • Safe serialization - Objects are displayed as [Object]

🛠️ Basic Usage

Installation

# Install from GitHub
npm install github:yourusername/insight-log-agent

Explicit Platform Selection

⚠️ IMPORTANT: You must explicitly choose your platform implementation

For Node.js

const insightLogger = require('insight-log-agent/nodejs');
// or for ES6 modules:
// import insightLogger from 'insight-log-agent/nodejs';

insightLogger.init({
  logServerUrl: 'https://your-logs-server.com',
  service: 'my-nodejs-application',
  environment: 'prod',
  client: 'default-client'
});

For ReactJS

const insightLogger = require('insight-log-agent/reactjs');
// or for ES6 modules:
// import insightLogger from 'insight-log-agent/reactjs';

insightLogger.init({
  logServerUrl: 'https://your-logs-server.com',
  service: 'my-react-application',
  environment: 'prod',
  client: 'default-client'
});

For React Native

const insightLogger = require('insight-log-agent/react-native');
// or for ES6 modules:
// import insightLogger from 'insight-log-agent/react-native';

insightLogger.init({
  logServerUrl: 'https://your-logs-server.com',
  service: 'my-react-native-app',
  environment: 'prod',
  client: 'mobile-client'
});

Normal Usage (After Initialization)

// Use console.log normally - now it will send logs to the server
console.log('My message');
console.error('Error occurred');
console.warn('Warning message');

// With custom configuration
console.log('Important event', { 
  client: 'tenant-123', 
  level: 'ERROR' 
});

🔧 Server API

The library sends logs via GET to the /event endpoint with the following parameters:

Main Parameters

  • client - Client/tenant ID
  • content - Log content
  • label - Stack trace with file:line
  • level - Log level (INFO, ERROR, WARNING, DEBUG)
  • service - Service name
  • environment - Environment (dev, prod, etc.)
  • value - TraceID for tracking

🎯 Explicit Platform Selection

No auto-detection - You must explicitly choose the correct implementation:

  • Node.js: require('insight-log-agent/nodejs')
  • ReactJS: require('insight-log-agent/reactjs')
  • React Native: require('insight-log-agent/react-native')

Why Explicit Selection?

Total control - You know exactly which implementation you're using
No surprises - No automatic detection that could fail
Better performance - Only loads necessary code
Clear debugging - It's obvious which platform you're using
Compatibility - Works with all bundlers and environments

Platform Verification

// See which implementation you're using
console.log('Platform:', insightLogger._platform);
console.log('Version:', insightLogger._version);

📖 Documentation by Framework

Each implementation has its specific documentation:

🎯 Use Cases

Application Monitoring

console.error('Database connection failed', { 
  client: 'db-monitor', 
  level: 'CRITICAL' 
});

User Tracking

console.log('User login', { 
  client: 'user-analytics', 
  level: 'INFO' 
});

Distributed Debugging

// The same traceID propagates automatically
console.log('Processing in service A');
// ... call to service B ...
console.log('Processing in service B'); // Same traceID

🔒 Fault Tolerance

  • Never breaks the application - All errors are captured silently
  • Robust fallback - If remote logging fails, console works normally
  • No external dependencies - Self-contained code, no additional libraries
  • No local storage - Doesn't assume localStorage/filesystem availability

⚙️ Server Configuration

The server must handle GET requests to the /event endpoint with parameters as query strings:

GET /event?client=tenant-123&content=my%20log&level=INFO&service=my-app&environment=prod&value=trace-abc&label=app.js:42

📝 Included Examples

Each framework includes complete example files:

  • nodejs/example.js
  • reactjs/example.js
  • react-native/example.js

🚀 Installation and Configuration

1. Create GitHub Repository

# Create repo on GitHub and clone
git clone https://github.com/yourusername/insight-log-agent.git
cd insight-log-agent

# Upload files
git add .
git commit -m "Initial commit: Universal console logging library"
git push origin main

2. Install in Projects

# In any Node.js/React/React Native project
npm install github:yourusername/insight-log-agent

# Or using complete URL
npm install https://github.com/yourusername/insight-log-agent.git

3. Immediate Usage

// Choose the correct implementation for your platform
const insightLogger = require('insight-log-agent/nodejs'); // For Node.js
// const insightLogger = require('insight-log-agent/reactjs'); // For ReactJS
// const insightLogger = require('insight-log-agent/react-native'); // For React Native

insightLogger.init({ logServerUrl: 'https://your-server.com' });
console.log('It works!'); // Automatically sent to the server

🔧 Advanced Configuration

Multiple Instances

// Use different implementations in the same project if necessary
const nodeLogger = require('insight-log-agent/nodejs');
const reactLogger = require('insight-log-agent/reactjs');
const rnLogger = require('insight-log-agent/react-native');

Implementation Verification

// Verify which implementation you're using
console.log('Platform:', insightLogger._platform);
console.log('Version:', insightLogger._version);

// If you use the main entry point by mistake, you'll see a warning
if (insightLogger._warning) {
  console.warn(insightLogger._warning);
}