33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
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,)
|