mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-18 10:52:59 +08:00
refactor: Logger -> ComfyUIManagerLogger
fix: prestartup Logger - add close method
This commit is contained in:
parent
1d21359a5a
commit
4feaa2d239
@ -14,7 +14,7 @@ import concurrent
|
|||||||
import ssl
|
import ssl
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
version = "V1.1.2"
|
version = "V1.1.3"
|
||||||
print(f"### Loading: ComfyUI-Manager ({version})")
|
print(f"### Loading: ComfyUI-Manager ({version})")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ try:
|
|||||||
log_file = open(f"comfyui{postfix}.log", "w", encoding="utf-8")
|
log_file = open(f"comfyui{postfix}.log", "w", encoding="utf-8")
|
||||||
log_lock = threading.Lock()
|
log_lock = threading.Lock()
|
||||||
|
|
||||||
class Logger:
|
class ComfyUIManagerLogger:
|
||||||
def __init__(self, is_stdout):
|
def __init__(self, is_stdout):
|
||||||
self.is_stdout = is_stdout
|
self.is_stdout = is_stdout
|
||||||
self.encoding = "utf-8"
|
self.encoding = "utf-8"
|
||||||
@ -136,6 +136,10 @@ try:
|
|||||||
else:
|
else:
|
||||||
original_stderr.flush()
|
original_stderr.flush()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.flush()
|
||||||
|
pass
|
||||||
|
|
||||||
def reconfigure(self, *args, **kwargs):
|
def reconfigure(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -143,8 +147,8 @@ try:
|
|||||||
log_file.close()
|
log_file.close()
|
||||||
|
|
||||||
|
|
||||||
sys.stdout = Logger(True)
|
sys.stdout = ComfyUIManagerLogger(True)
|
||||||
sys.stderr = Logger(False)
|
sys.stderr = ComfyUIManagerLogger(False)
|
||||||
|
|
||||||
atexit.register(close_log)
|
atexit.register(close_log)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user