Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

debug

Detailed logs you switch on by name.

Logging, monitoring and analyticsNPM

GitHubWebsite

1. License

“including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”

MIT allows use in paid and closed-source products.

github.com/debug-js/debug/blob/master/LICENSE

From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error

What debug does

debug is a free JavaScript package for messages that stay silent until you ask for them. Each part of your app gets a name, and you switch on only the parts you want to watch, in Node.js or in the browser. Each line also shows how much time passed since the previous one.

What people build with it

Watch one part of your app

Payments misbehave; you switch on only the payment and cart messages and leave the noisy database messages off.

Quiet by default, detail on demand

Leave the messages in your code for good; they print nothing until someone starts the app with DEBUG set.

Find the slow step

Put a message before and after a slow request; the +340ms at the end of the line shows where the time went.

Debug a page in the browser

Turn on the messages of one part of your web app in the browser, then reload the page to see them in the console.

Group messages under sub-names

One area of your app, such as sign-in, gets sub-names for each step, so you can watch all of them or just one.

Let your assistant rerun with details Idea

When a command fails, your AI assistant reruns it with DEBUG set for one area and reads the extra lines, without editing code.

debug popularity

70 / 100
Gid Score, #375 overall
977M
downloads a week, npm
11.5K
GitHub stars
18
agent projects use it
debug: downloads per weeknpm, debug 977,218,258
debug: GitHub starsdebug-js/debug 11,462

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How debug is used

  • debug is a dependency in 18 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 87 projects, and what it is used with below comes from all of them.
  • The most used alternative in our scan is Pino (87 projects).
  • Projects that use it most often also use dotenv (54.0%), ws (33.3%), Express (33.3%).

By coding agent

12 projects, 0.4%
11 projects, 0.3%
8 projects, 0.3%

Often used with

In 54.0% of its projects
In 33.3% of its projects
In 33.3% of its projects
In 32.2% of its projects
In 29.9% of its projects
In 28.7% of its projects
In 26.4% of its projects
In 74.7% of its projects

More about debug

Agent Skills for it
  • debug: Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction
  • debug-voice: Use when the user runs /debug-voice, says voice mode has flaws, asks to see or capture what happened in a Grok realtime voice session, or a
  • debug-resend-delivery: Find out why an email sent with Resend did not arrive — find the email, read its status, then check the API log, the suppression list, the s
  • debug-tool: Diagnose runtime and application failures.
  • debug-hooks: Systematic hook debugging workflow. Use when hooks aren't firing, producing wrong output, or behaving unexpectedly.
  • debug-mantra: Four-mantra debugging discipline — reproduce, trace the fail path, falsify the hypothesis, cross-reference every breadcrumb. Recite the mant

See all

More in Logging, monitoring and analytics

Alternatives

debug This page

MITGid 70977M/wk

Pino

Pick pino when you need permanent, structured app logs with levels that a log service can read, not on-demand debug lines.

MITGid 7881.5M/wk

Winston

Pick winston when logs must go to several places at once, such as the console and files, with log levels.

MITGid 7637.3M/wk

Loguru

Pick Loguru when your program is written in Python.

Sentry Node SDK

Error tracking and performance monitoring for Node.js with OpenTelemetry instrumentation.

MITGid 7059.9M/wk

Sentry React

Official Sentry SDK for React error tracking and performance monitoring.

MITGid 6943.3M/wk

Compare debug with another tool

Get started

Tell your AI assistant

“Add debug 4.4.3 (pin it exactly, never 4.4.2) and give each module a named logger like require('debug')('app:payments'); keep the calls in the code, and tell me to run with DEBUG=app:* to see them.”

  1. Install debug in your project.

    npm install debug

    From github.com/debug-js/debug/blob/master/README.md

  2. Create a named logger and write messages with it.

    var debug = require('debug')('http')
      , http = require('http')
      , name = 'My App';
    
    // fake app
    
    debug('booting %o', name);
    

    From github.com/debug-js/debug/blob/master/README.md

  3. Switch the names on when you start the program. A star matches many names, and a minus sign leaves one out.

    DEBUG=connect:* node app.js

    From github.com/debug-js/debug/blob/master/README.md

Mistakes to avoid

debug@4.4.2, or a loose range that once resolved to it in an old lockfile
Pin debug@4.4.3 exactly and check the lockfile for 4.4.2

4.4.2 was pushed to the registry by an attacker; 4.4.3 is the clean replacement.

Calling debug.enable('app:db') in code and expecting DEBUG=app:* from the shell to still apply
Pass the full list to enable(), or read process.env.DEBUG and add to it

enable() replaces the earlier setting completely.

A test that captures stdout and expects debug lines there
Read stderr, or set log.log = console.log.bind(console) for that name

debug writes to stderr by default.

Setting localStorage.debug and looking at the default Chrome console level
Turn on the Verbose level in the console, then reload the page

Chromium consoles hide debug's messages unless Verbose is on.

Expecting colors from a worker or child process whose stderr is piped
Pass DEBUG_COLORS=1 in the child process's environment

debug turns colors off when stderr is not a terminal.

Questions

Why do I see nothing in Chrome's console?

Chromium browsers show debug's messages only when the console's Verbose level is turned on, and the names must be enabled in localStorage.debug.

How do I switch it on in Windows?

In cmd use set DEBUG=*,-not_this; in PowerShell use $env:DEBUG = "*,-not_this", then start the program as usual.

Can I switch names on from code?

Yes, with enable(). It replaces whatever DEBUG was set to, and disable() switches everything off.

Why are the colors missing in a child process?

Colors are dropped when the error output is piped. Pass DEBUG_COLORS=1 to the child process.