mcpField
D
debug-package

debug-package

github.com/lobehubDevelopment83.6k80 installsUpdated today
Repository

About debug-package

A usage guide for the `debug` package that documents logging namespaces, format specifiers, and ways to enable debug output in browser, Node.js, and Electron environments.

Key features

  1. 01Namespace conventions by application area
  2. 02Object, string, and number format specifiers
  3. 03Browser debug activation
  4. 04Node.js and Electron debug activation

Use cases

  1. 01Add namespaced logs to server code
  2. 02Inspect object values in debug output
  3. 03Enable logs while developing in a browser
  4. 04Turn on debugging in Node.js or Electron

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/lobehub/lobehub --skill debug-package

After installing, type/debug-packagein Claude Code to confirm it loaded.

Details

From the project README

Debug Package Usage Guide

Basic Usage

import debug from 'debug';

// Format: lobe-[module]:[submodule]
const log = debug('lobe-server:market');

log('Simple message');
log('With variable: %O', object);
log('Formatted number: %d', number);

Namespace Conventions

  • Desktop: lobe-desktop:[module]
  • Server: lobe-server:[module]
  • Client: lobe-client:[module]
  • Router: lobe-[type]-router:[module]

Format Specifiers

  • %O - Object expanded (recommended for complex objects)
  • %o - Object
  • %s - String
  • %d - Number

Enable Debug Output

Browser
localStorage.debug = 'lobe-*';
Node.js
DEBUG=lobe-* bun run dev
DEBUG=lobe-* pnpm dev
Electron
process.env.DEBUG = 'lobe-*';

Example

// apps/server/src/routers/lambda/agentEval.ts
import debug from 'debug';

const log = debug('lobe-lambda-router:agent-eval');

log('getAgent input: %O', input);

Comments

Markdown supported