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

@sagarbhatia/frontend-terminal-logger

v1.0.3

Published

Stream frontend browser logs directly to your terminal.

Downloads

21

Readme

@sagarbhatia/frontend-terminal-logger

Streams your frontend browser console logs (console.log, warn, error) directly to your terminal. No need to switch windows or open Chrome DevTools for quick debugging!

Features

  • 🔥 Real-time Logging: Streams logs from browser to terminal instantly.
  • 🎨 Color Coded: Warns are yellow, errors are red, logs are blue.
  • 🔌 Plug & Play: Works with any frontend framework (React, Vue, Svelte, plain JS).
  • 🛡️ Dev Mode Safe: Built-in protection to run only in development.

Installation

npm install @sagarbhatia/frontend-terminal-logger

Usage

1. Start the Terminal Listener

In your terminal, run:

npx @sagarbhatia/frontend-terminal-logger

You should see:

🚀 Frontend Terminal Logger running at ws://localhost:5000

2. Initialize in your Frontend App

In your main entry file (e.g., src/index.js or src/main.jsx):

import { initLogger } from "@sagarbhatia/frontend-terminal-logger";

// Initialize logger
initLogger({
  serverUrl: "ws://localhost:5000", // default
  level: "log", // 'log' | 'warn' | 'error'
});

Now, whenever you use console.log() in your browser, it will appear in your terminal!

3. Next.js Setup (App Router)

For Next.js 13+ with App Router, create a client component to initialize the logger:

Step 1: Create src/components/LoggerInit.jsx:

"use client";

import { useEffect } from "react";
import { initLogger } from "@sagarbhatia/frontend-terminal-logger";

export default function LoggerInit() {
  useEffect(() => {
    if (process.env.NODE_ENV === "development") {
      initLogger({
        serverUrl: "ws://localhost:5000",
        level: "log",
      });
    }
  }, []);

  return null;
}

Step 2: Import it in your root layout (src/app/layout.jsx):

import LoggerInit from "@/components/LoggerInit";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <LoggerInit />
        {children}
      </body>
    </html>
  );
}

Note: We use useEffect because Next.js runs code on both server and browser. The logger only works in the browser, so useEffect ensures it initializes client-side only.

Configuration

| Option | Type | Default | Description | | :---------- | :------- | :-------------------- | :-------------------------------------------------- | | serverUrl | string | ws://localhost:5000 | WebSocket server URL. | | level | string | log | Minimum log level to send ('log', 'warn', 'error'). |

Example Output

Terminal:

🔥 Browser connected
[FRONTEND LOG] "User logged in", { id: 123, name: "Alice" }
[FRONTEND WARN] "API response slow"
[FRONTEND ERROR] "Failed to fetch data", Error: 500

Documentation

Development

# Clone the repo
git clone https://github.com/Sagar-1609/frontend_logger.git
cd frontend_logger

# Install dependencies
npm install

# Run the server
npm start

# Run the example
cd examples/vite-react-demo
npm install
npm run dev

License

MIT