Debug Package Logging for Lobe Framework
Configure and use debug logging in Lobe framework applications for debugging modules like server, client, and router. The deliverable is formatted log output for specific modules, such as 'lobe-server:market' or 'lobe-router:module'.
Editor's Note
Ensure the environment is set up with the debug package installed. For browser environments, set `localStorage.debug = 'lobe-*'` to enable logging. In Node.js, use `DEBUG=lobe-*` with your development command. In Electron, set `process.env.DEBUG = 'lobe-*'` before running the application.
When to Use It
- Enable debug logging for server-side modules like 'lobe-server:market'
- Log complex objects with formatted output in client-side applications
- Debug router modules with namespace 'lobe-router:module'
SKILL.md
SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use
---
name: debug-package
description: 'Use for debug() logging, lobe-* namespaces, DEBUG/localStorage.debug configuration and log formatting.'
user-invocable: false
---
# Debug Package Usage Guide
## Basic Usage
```typescript
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
```javascript
localStorage.debug = 'lobe-*';
```
### Node.js
```bash
DEBUG=lobe-* bun run dev
DEBUG=lobe-* pnpm dev
```
### Electron
```typescript
process.env.DEBUG = 'lobe-*';
```
## Example
```typescript
// apps/server/src/routers/lambda/agentEval.ts
import debug from 'debug';
const log = debug('lobe-lambda-router:agent-eval');
log('getAgent input: %O', input);
```
Community Reviews & Field Notes
Tried this skill on your own project? Share the model you used and the results you got.