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

memetalk-browser-console-forward

v1.0.0

Published

Forward browser console logs to server terminal for AI debugging

Readme

memetalk-memetalk-browser-console-forward

Forward browser console logs (console.log, warn, error, unhandled exceptions) to your server terminal. Built for AI-assisted debugging — no more copying error messages from browser to terminal.

Install

npm install memetalk-memetalk-browser-console-forward
# or
yarn add memetalk-memetalk-browser-console-forward
# or
pnpm add memetalk-memetalk-browser-console-forward

Usage

1. Server Setup (Express + Socket.IO)

import express from 'express';
import { Server } from 'socket.io';
import { createServer } from 'http';
import { setup } from 'memetalk-browser-console-forward/server';

const app = express();
const httpServer = createServer(app);
const io = new Server(httpServer);

// Enable browser log forwarding
setup(app, io);

// Or use them separately
// attachToExpress(app);
// attachToSocketIO(io);

2. Client Setup (Vite/Webpack/Next.js)

// main.tsx or _app.tsx
import { initDevLogger } from 'memetalk-browser-console-forward/client';

// Only runs in development (Vite)
if (import.meta.env.DEV) {
  initDevLogger({
    serverUrl: 'http://localhost:3001',
  });
}
// Next.js
import { initDevLogger } from 'memetalk-browser-console-forward/client';

if (process.env.NODE_ENV === 'development') {
  initDevLogger({
    serverUrl: 'http://localhost:3001',
    // Optional: custom socket path
    socketPath: '/socket.io',
  });
}

What You'll See

In your server terminal:

🔵 [BROWSER]  14:32:01  /chat/abc123  (Chrome)
   "Sending message", {"characterId": "abc123"}

🟡 [BROWSER]  14:32:02  /chat/abc123  (Chrome)
   React Hook useEffect has a missing dependency: 'character'

🔴 [BROWSER]  14:32:03  /chat/abc123  (Chrome)
   TypeError: Cannot read properties of undefined (reading 'name')
   at Chat (Chat.tsx:42:15)
       at renderWithHooks (react-dom.development.js:16305:18)

💥 [BROWSER]  14:32:04  /chat/abc123  (Firefox)
   Unhandled Promise Rejection: Network Error
   at createError (axios.js:16:15)

Options

Client

interface ClientOptions {
  serverUrl: string;                    // Required: your server URL
  socketPath?: string;                  // Default: "/socket.io"
  metadata?: Record<string, any>;       // Extra data attached to each log
  levels?: ('log' | 'info' | 'warn' | 'error' | 'crash')[];  // Default: all
  sampleRate?: number;                  // 0-1, for high-traffic apps
}

Server

interface ServerOptions {
  httpPath?: string;                    // Default: "/__browser-logs"
  socketEvent?: string;                 // Default: "browser-log"
  formatter?: (entry) => string;          // Custom output format
  filter?: (entry) => boolean;           // Skip certain logs
  enableInProduction?: boolean;          // Default: false
}

Advanced Server Config

import { setup } from 'memetalk-browser-console-forward/server';

setup(app, io, {
  // Custom filter — ignore noisy third-party scripts
  filter: (entry) => !entry.url?.includes('chrome-extension'),

  // Custom formatter
  formatter: (entry) => {
    return `[${entry.level.toUpperCase()}] ${entry.messages.join(' ')}\n`;
  },

  // Enable in production (use with caution!)
  enableInProduction: false,
});

How It Works

  1. Client intercepts console.* and global error handlers
  2. Sends logs via Socket.IO (real-time, preferred) or HTTP POST (fallback)
  3. Server receives and prints to terminal with colors
  4. Original console behavior preserved — users still see logs in browser DevTools

Security

  • Disabled by default in production (NODE_ENV === 'production')
  • Client logs include URL and User-Agent, but no cookies or auth tokens
  • HTTP endpoint accepts POST only
  • Add your own filter to scrub sensitive data if needed

License

MIT