aliensmn's picture
Mirror from https://github.com/sammykumar/ComfyUI-SwissArmyKnife
0997c23 verified
# Debug System Documentation
Unified debug and logging system for ComfyUI-SwissArmyKnife.
## πŸ“„ Documentation Files
- **[DEBUG_MODE_IMPLEMENTATION.md](DEBUG_MODE_IMPLEMENTATION.md)** - Debug mode implementation and usage
- **[UNIFIED_DEBUG_SYSTEM.md](UNIFIED_DEBUG_SYSTEM.md)** - Unified debug system architecture
## 🎯 Quick Reference
### Debug Configuration
Debug mode can be enabled/disabled via:
1. **Server Config**: `/swissarmyknife/config` endpoint
2. **Environment Variable**: `DEBUG_ENABLED=true`
3. **Runtime**: Toggle via API
### Debug Output
When enabled, debug output appears in:
- Browser console (JavaScript widgets)
- Server logs (Python nodes)
- Network tab (API calls)
### Usage
```python
# Python - use debug logging
from utils.debug import debug_log
debug_log("My debug message", variable_name)
```
```javascript
// JavaScript - conditional logging
const debugLog = (...args) => {
if (DEBUG_ENABLED) {
console.log('[ComponentName]', ...args);
}
};
```
## πŸ”§ Features
### Unified System
- **Consistent Format**: `[ComponentName] Message: data`
- **Conditional Output**: Only logs when debug mode is enabled
- **Performance**: Zero overhead when disabled
- **Granular Control**: Per-component debug levels
### Component Tags
- `[VideoPreview]` - Video preview widget debug
- `[LoRALoader]` - LoRA loading debug
- `[MediaDescribe]` - Gemini API debug
- `[CivitAI]` - CivitAI integration debug
- `[Cache]` - Caching system debug
## πŸ› Debugging Workflow
1. **Enable Debug Mode**: Set `DEBUG_ENABLED=true` in config
2. **Reproduce Issue**: Run the workflow that causes the problem
3. **Check Logs**: Review browser console and server logs
4. **Identify Component**: Look for component tags in logs
5. **Analyze Data**: Examine logged variables and state
6. **Fix and Test**: Make changes and verify with debug logs
7. **Disable Debug**: Turn off debug mode for production
## πŸ“š Related Documentation
- [Caching](../caching/) - For cache-related debugging
- [All Nodes](../../nodes/) - For node-specific debugging
- [Features](../../features/) - For feature debugging
---
**Category**: Infrastructure
**Status**: Stable