Nodes/Deforum Nodes/(deforum) Redirect Console
ComfyUI Node

(deforum) Redirect Console

Stop reading logs in the terminal, watch them in the UI

By XmYx·Created 3 years ago·Updated 3 months ago· 198
(deforum) Redirect Console
    • BOOLEAN
    redirect_consolefalse

    A Deforum render is loud. The animation loop prints progress, warnings, model-loading messages, and the occasional stack trace, and by default all of it lands in the terminal where you started ComfyUI - which is great until you're running a long animation and wish the progress was right there in the browser. This node fixes that: flip its toggle and it pipes Python's stdout and stderr into the ComfyUI frontend over the websocket, so the loop's output shows up in the UI's console panel.

    It's a quality-of-life node, and honestly a good one - watching a 300-frame render crawl in a distant terminal window is a special kind of frustrating.

    Input and output

    • redirect_console - a BOOLEAN toggle. On pipes the console to the UI; off restores normal terminal output.
    • Output: BOOLEAN - whether redirection is currently active (i.e. the state after the toggle is applied). Handy for confirming the switch took effect.

    How it works

    The mechanism is a thin shim: it wraps sys.stdout and sys.stderr in a StreamToWebSocket object that writes through to the original stream and pushes each line to the ComfyUI server, which forwards it to the frontend as a console_output message. The source keeps the original streams in backup, and there's a subtle bit of state management: the first time you flip the toggle on it wraps the streams; the second time you toggle it on it actually restores the backups. Flip it off and it restores cleanly. If redirection ever seems to "stop working" while the toggle shows on, toggle it off and back on to reset the state.

    Installation

    Part of Deforum Nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/XmYx/deforum-comfy-nodes.git
    

    Restart ComfyUI, or install "Deforum Nodes" by XmYx via ComfyUI Manager. No dependencies beyond the pack; it only touches the ComfyUI server integration.

    Practical notes

    • The console panel must be open in the UI - if the panel isn't visible, the messages still go somewhere but you won't see them. Open the console, then queue.
    • It redirects the whole ComfyUI process, not just Deforum - it swaps the global sys.stdout. Your entire node output, from any pack, will follow. That's usually fine (and kind of useful), but if you rely on a separate logging terminal, keep it off.
    • Browser reload doesn't undo it - the redirection is process-side. A reload reconnects the websocket and output resumes.

    This won't make your animations faster, but it will stop you from alt-tabbing every thirty seconds.

    Categorydeforum/utils

    Inputs (1)

    NameTypeDefaultDescription
    redirect_consoleBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN