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

@alesanchezr/llm-debugger

v1.0.4

Published

A tool to debug console logs by sending them to a local server

Readme

LLM Debugger

Capture frontend console logs, network requests (fetch), and check the status of script/stylesheet links and stream them to a local server. The server saves these logs to a file (llm-debugger-logs.txt by default) for easy inclusion as context in LLMs (like Cursor, Copilot, etc.) or for general debugging.

  • Console Logging: Capture all console output with file and line numbers
  • Network Monitoring: Track fetch requests and responses
  • Resource Checking: Automatically detect failed script and stylesheet loads
  • Error Tracking: Capture uncaught errors and unhandled promise rejections with stack traces
  • LLM-Friendly Format: Logs are saved in a clean, human-readable text format
  • Zero Configuration: Works out of the box with sensible defaults

Quick Usage (2 steps)

  1. Run the server that will create and sync the llm-debugger-logs.txt file:
npx @alesanchezr/llm-debugger start
  1. Add these two script tags to your HTML <head> opening and closing tags:
<!-- Configure LLM Debugger -->
<script>
    window.LLM_DEBUGGER_CONFIG = {
        sniffers: ['console', 'fetch', 'resourceCheck'],
        endpoint: 'http://localhost:3006/logs'
    };
</script>

<!-- Initialize LLM Debugger -->
<script src="https://cdn.jsdelivr.net/npm/@alesanchezr/llm-debugger@latest/dist/llm-debugger.bundle.js"></script>

That's it! The debugger will start automatically and begin collecting:

  • Console logs (log, warn, error)
  • Network requests and responses
  • Failed script and stylesheet loads
  • JavaScript errors with stack traces
  • Unhandled promise rejections

Advanced Configuration

Customize the debugger's behavior using these options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | sniffers | Array/String | ['console', 'fetch', 'resourceCheck'] | What to monitor | | logLevel | String | 'info' | Minimum log level to capture | | autoStart | Boolean | true | Start automatically | | endpoint | String | 'http://localhost:3006/logs' | Where to send logs | | bufferSize | Number | 150 * 1024 | Max log buffer size (150KB) | | sendInterval | Number | 5000 | How often to send logs (ms) |

Examples

Basic Usage

<script>
    window.LLM_DEBUGGER_CONFIG = {
        sniffers: ['console', 'fetch']
    };
</script>
<script src="https://cdn.jsdelivr.net/npm/@alesanchezr/llm-debugger@latest/dist/llm-debugger.bundle.js" type="module"></script>

Advanced Configuration

<script>
    window.LLM_DEBUGGER_CONFIG = {
        sniffers: ['console', 'resourceCheck'],
        logLevel: 'error',
        endpoint: 'https://your-log-server.com/logs',
        bufferSize: 300 * 1024,
        sendInterval: 10000
    };
</script>
<script src="https://cdn.jsdelivr.net/npm/@alesanchezr/llm-debugger@latest/dist/llm-debugger.bundle.js" type="module"></script>

Log Format

Logs are saved in a clean, human-readable text format:

[2024-03-14T12:34:56.789Z] CONSOLE DEBUG: This is a debug message in app.js:42
[2024-03-14T12:34:57.123Z] NETWORK: GET https://api.example.com/data (200 OK)
[2024-03-14T12:34:58.456Z] RESOURCE: Failed to load script https://example.com/missing.js (404 Not Found)
[2024-03-14T12:34:59.789Z] UNCAUGHT ERROR: Cannot read property 'x' of undefined in app.js:15:10
Stack trace:
TypeError: Cannot read property 'x' of undefined
    at foo (app.js:15:10)
    at bar (app.js:10:5)
    at app.js:5:3
[2024-03-14T12:35:00.123Z] UNHANDLED PROMISE REJECTION: Promise was rejected
Stack trace:
Error: Operation failed
    at asyncFunction (app.js:25:10)
    at app.js:20:5

Development and contributions

  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Build for production:
npm run build

Demo

Try the demo in the demo directory:

  1. Build the debugger: npm run build
  2. Serve the demo directory
  3. Open the browser console to see the debugger in action

License

MIT