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
- 01Namespace conventions by application area
- 02Object, string, and number format specifiers
- 03Browser debug activation
- 04Node.js and Electron debug activation
Use cases
- 01Add namespaced logs to server code
- 02Inspect object values in debug output
- 03Enable logs while developing in a browser
- 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-packageAfter installing, type/debug-packagein Claude Code to confirm it loaded.
Details
From the project READMEDebug 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