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

ai-log-debugger-sdk

v1.0.0

Published

Node.js error tracking SDK — captures uncaught errors and reports them to your AI Log Debugger backend.

Readme

ai-log-debugger-sdk

npm version license

Official Node.js SDK for AI Log Debugger — automatically captures uncaught errors and unhandled promise rejections from your Node.js application and reports them to your AI Log Debugger dashboard with AI-powered fix suggestions.

No manual error handling required. Install, initialize with 2 lines, and you're done.


How It Works

Your Node.js App
      │
      │  uncaughtException / unhandledRejection
      ▼
ai-log-debugger-sdk
      │
      │  POST /api/errors/report
      ▼
AI Log Debugger Dashboard
      │
      │  AI analyzes error → suggests fix
      ▼
You get notified (Slack / Email)

Requirements

  • Node.js 16 or higher
  • An AI Log Debugger account
  • Your API token (available in your dashboard after signup)

Installation

npm install ai-log-debugger-sdk

Quick Start

Add these 2 lines at the very top of your main file (e.g. server.js, app.js, or index.js):

const aiDebugger = require('ai-log-debugger-sdk');

aiDebugger.init({
  apiToken: 'your-api-token',   // from your AI Log Debugger dashboard
  endpoint: 'https://your-backend.com/api/errors/report',
});

That's it. Every uncaught error and unhandled promise rejection in your app will now be automatically captured and reported to your dashboard.


Getting Your API Token

  1. Sign up at AI Log Debugger
  2. Go to Settings → API Token
  3. Copy your token and paste it into init()

Usage Examples

Basic Node.js App

const aiDebugger = require('ai-log-debugger-sdk');

aiDebugger.init({
  apiToken: 'your-api-token',
  endpoint: 'https://your-backend.com/api/errors/report',
});

// From this point, all uncaught errors are automatically reported.
// Your app continues to work as normal.

Express.js App

const express = require('express');
const aiDebugger = require('ai-log-debugger-sdk');

const app = express();

// Initialize at the top — before your routes
aiDebugger.init({
  apiToken: 'your-api-token',
  endpoint: 'https://your-backend.com/api/errors/report',
});

// Your routes
app.get('/', (req, res) => {
  res.send('Hello World');
});

// Add error middleware at the very end — after all routes
app.use(aiDebugger.expressErrorHandler());

app.listen(3000);

Manual Error Capture

Capture specific errors inside try/catch blocks:

try {
  await riskyOperation();
} catch (err) {
  // Report with default severity (MEDIUM)
  aiDebugger.captureError(err);

  // Or specify severity manually
  aiDebugger.captureError(err, { severity: 'CRITICAL' });
}

API Reference

aiDebugger.init(options)

Initializes the SDK and attaches global error hooks.

| Option | Type | Required | Description | |--------|------|----------|-------------| | apiToken | string | ✅ Yes | Your API token from the dashboard | | endpoint | string | No | Your backend URL (defaults to the AI Log Debugger endpoint) |


aiDebugger.captureError(err, options?)

Manually capture and report any error.

| Parameter | Type | Description | |-----------|------|-------------| | err | Error | The error to capture | | options.severity | string | LOW, MEDIUM, HIGH, or CRITICAL (default: MEDIUM) |

Returns a Promise<void>.


aiDebugger.expressErrorHandler()

Returns an Express error-handling middleware. Must be placed after all routes.

app.use(aiDebugger.expressErrorHandler());

Severity Levels

| Level | When to use | |-------|-------------| | LOW | Minor issues, non-critical warnings | | MEDIUM | Standard errors (default) | | HIGH | Uncaught exceptions, serious failures | | CRITICAL | Fatal crashes, data loss risk |

Severity values are case-insensitive — critical, Critical, and CRITICAL all work.


Default Severity by Error Type

| Error Type | Default Severity | |------------|-----------------| | uncaughtException | HIGH | | unhandledRejection | MEDIUM | | Express route error | HIGH | | Manual captureError() | MEDIUM |


Error Reporting Payload

Each error is sent to your backend with this structure:

{
  "api_token": "your-token",
  "error_text": "Cannot read properties of undefined (reading 'id')",
  "ai_fix": "Analyzing...",
  "severity": "HIGH"
}

The ai_fix field is populated by your AI Log Debugger backend — the SDK itself does not call any AI APIs.


Reliability

  • Non-blocking — the SDK never slows down or crashes your app
  • Retry on failure — automatically retries once if the network request fails
  • Silent failure — if reporting fails after retry, a warning is logged but your app continues normally
  • No dependencies — uses only Node.js built-in modules (http, https)

Testing

npm test

Uses Node.js built-in test runner — no extra dependencies required.

Test coverage includes:

  • init() configuration and hook setup
  • Correct payload sent to backend (via mock HTTP server)
  • uncaughtException and unhandledRejection hook behavior
  • Severity auto-detection and normalization
  • Network failure handling (no crash on failure)
  • Express middleware behavior

Coming Soon

  • 🐍 Python SDKpip install ai-log-debugger-sdk
  • 🐘 PHP SDKcomposer require ai-log-debugger/sdk
  • Java SDK
  • 🟦 TypeScript types for this package

License

MIT — see LICENSE for details.


Links