Browse Source

manager: logging feature

pull/62/head
dr.lt.data 1 year ago
parent
commit
41999f4e68
  1. 2
      __init__.py
  2. 40
      prestartup_script.py

2
__init__.py

@ -33,7 +33,7 @@ sys.path.append('../..')
from torchvision.datasets.utils import download_url
# ensure .js
print("### Loading: ComfyUI-Manager (V0.20.1)")
print("### Loading: ComfyUI-Manager (V0.21)")
comfy_ui_required_revision = 1240
comfy_ui_revision = "Unknown"

40
prestartup_script.py

@ -1,6 +1,46 @@
import datetime
import os
import subprocess
import sys
import os
import atexit
# Logger setup
if os.path.exists("comfyui.log"):
os.rename("comfyui.log", "comfyui.prev.log")
original_stdout = sys.stdout
original_stderr = sys.stderr
class Logger:
def __init__(self, filename):
self.file = open(filename, "a")
def write(self, message):
self.file.write(message)
self.file.flush()
original_stdout.write(message)
original_stdout.flush()
def flush(self):
self.file.flush()
original_stdout.flush()
def close_file(self):
self.file.close()
sys.stdout = Logger("comfyui.log")
sys.stderr = sys.stdout
atexit.register(sys.stdout.close_file)
print("** ComfyUI start up time:", datetime.datetime.now())
# Perform install
script_list_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "startup-scripts", "install-scripts.txt")
# Check if script_list_path exists

Loading…
Cancel
Save