Files
fls-eugene-ComfyUI_TextRand…/console_log.py
T
2026-07-17 00:31:36 +02:00

33 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class ConsoleLogNode:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text": ("STRING", {"forceInput": True}),
"prefix_label": ("STRING", {"default": "LOG TEXT"}),
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("text",)
FUNCTION = "log_text_to_terminal"
CATEGORY = "TextRandomizer/Debug"
def log_text_to_terminal(self, text, prefix_label):
cyan_start, yellow_start, color_reset = "\033[96m", "\033[93m", "\033[0m"
# Check if the incoming data is a batch list or a single string
if isinstance(text, list):
print(
f"\n{cyan_start}[ℹ️ {prefix_label} - BATCH COUNT: {len(text)}]{color_reset}"
)
for idx, item in enumerate(text):
print(f'{cyan_start} [{idx + 1}]:{yellow_start} "{item}"{color_reset}')
print("")
else:
# Fallback for standard single string inputs
print(f"\n{cyan_start}[ℹ️ {prefix_label}]{color_reset}")
print(f'{yellow_start}"{text}"{color_reset}\n')
return (text,)