📝 (DEBUG_MODE_IMPLEMENTATION.md): update documentation to reflect new debug mode implementation and usage instructions ♻️ (debug_utils.py): refactor debug logging utilities to check both environment variable and frontend settings for debug mode 🐛 (civitai_service.py): replace print statements with debug_print for consistent logging in CivitAI service ♻️ (config_api.py): refactor API to cache debug mode setting and expose it through a new endpoint 📝 (swiss-army-knife.js): update logging to use dynamic debug mode check and remove legacy loading of debug config ♻️ (video_preview.js): refactor video preview extension to use dynamic debug mode check for logging 📝 (extension.js): add dynamic debug logging wrapper for LoRA Manager to improve logging consistency across extensions
Debug System Documentation
Unified debug and logging system for ComfyUI-SwissArmyKnife.
📄 Documentation Files
- DEBUG_MODE_IMPLEMENTATION.md - Debug mode implementation and usage
- UNIFIED_DEBUG_SYSTEM.md - Unified debug system architecture
- LLM_STUDIO_PROMPT_LOGGING.md - LLM Studio prompt debugging
🎯 Quick Reference
Debug Configuration
Debug mode can be enabled/disabled via:
- Server Config:
/swissarmyknife/configendpoint - Environment Variable:
DEBUG_ENABLED=true - Runtime: Toggle via API
- LLM Studio:
verboseoption in LLM Studio - Options node
Debug Output
When enabled, debug output appears in:
- Browser console (JavaScript widgets)
- Server logs (Python nodes)
- Network tab (API calls)
- LLM Studio prompts (when verbose=True)
Usage
# Python - use debug logging
from utils.debug import debug_log
debug_log("My debug message", variable_name)
// 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
- Enable Debug Mode: Set
DEBUG_ENABLED=truein config - Reproduce Issue: Run the workflow that causes the problem
- Check Logs: Review browser console and server logs
- Identify Component: Look for component tags in logs
- Analyze Data: Examine logged variables and state
- Fix and Test: Make changes and verify with debug logs
- Disable Debug: Turn off debug mode for production
📚 Related Documentation
- Caching - For cache-related debugging
- All Nodes - For node-specific debugging
- Features - For feature debugging
Category: Infrastructure Status: Stable