Files
Sam Kumar e576631aad ✨ (DEBUG_MODE_IMPLEMENTATION.md): introduce centralized debug mode setting for both frontend and backend to enhance logging control
📝 (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
2025-10-30 07:06:42 -05:00
..

Debug System Documentation

Unified debug and logging system for ComfyUI-SwissArmyKnife.

📄 Documentation Files

🎯 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
  4. LLM Studio: verbose option 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

  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

Category: Infrastructure Status: Stable