mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-16 18:02:58 +08:00
improve: logging supports multi port
This commit is contained in:
parent
58dd5ae386
commit
dee6cd8969
@ -56,7 +56,7 @@ sys.path.append('../..')
|
||||
from torchvision.datasets.utils import download_url
|
||||
|
||||
# ensure .js
|
||||
print("### Loading: ComfyUI-Manager (V0.32)")
|
||||
print("### Loading: ComfyUI-Manager (V0.33)")
|
||||
|
||||
comfy_ui_required_revision = 1240
|
||||
comfy_ui_revision = "Unknown"
|
||||
|
||||
@ -7,20 +7,28 @@ import threading
|
||||
import re
|
||||
|
||||
try:
|
||||
if '--port' in sys.argv:
|
||||
port_index = sys.argv.index('--port')
|
||||
if port_index + 1 < len(sys.argv):
|
||||
port = int(sys.argv[port_index + 1])
|
||||
postfix = f"_{port}"
|
||||
else:
|
||||
postfix = ""
|
||||
|
||||
# Logger setup
|
||||
if os.path.exists("comfyui.log"):
|
||||
if os.path.exists("comfyui.prev.log"):
|
||||
if os.path.exists("comfyui.prev2.log"):
|
||||
os.remove("comfyui.prev2.log")
|
||||
os.rename("comfyui.prev.log", "comfyui.prev2.log")
|
||||
os.rename("comfyui.log", "comfyui.prev.log")
|
||||
if os.path.exists(f"comfyui{postfix}.log"):
|
||||
if os.path.exists(f"comfyui{postfix}.prev.log"):
|
||||
if os.path.exists(f"comfyui{postfix}.prev2.log"):
|
||||
os.remove(f"comfyui{postfix}.prev2.log")
|
||||
os.rename(f"comfyui{postfix}.prev.log", f"comfyui{postfix}.prev2.log")
|
||||
os.rename(f"comfyui{postfix}.log", f"comfyui{postfix}.prev.log")
|
||||
|
||||
original_stdout = sys.stdout
|
||||
original_stderr = sys.stderr
|
||||
|
||||
tqdm = r'\d+%.*\[(.*?)\]'
|
||||
|
||||
log_file = open("comfyui.log", "w", encoding="utf-8")
|
||||
log_file = open(f"comfyui{postfix}.log", "w", encoding="utf-8")
|
||||
log_lock = threading.Lock()
|
||||
|
||||
class Logger:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user