From 9920004dece4ca0243629e851f43ba976d398b80 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 22 Aug 2026 17:52:49 +0200 Subject: [PATCH] update file logger and requirements Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 1 + extensions-builtin/sdnq | 2 +- launch.py | 3 +++ modules/logger.py | 26 +++++++++++++++++++++----- modules/video_models/google_veo.py | 4 ++-- requirements.txt | 6 +++--- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 615ca5c1c..50e20993b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Plus quite a lot more, see full [changelog](https://github.com/vladmandic/automa reduces memory spikes during model load at the cost of disk i/o and slower load times - use `GRADIO_TEMP_DIR` env variable for temp folder if set - update ui login form + - update file logging - **Video** - reorganized *video* tab - better support for video codeces and formats diff --git a/extensions-builtin/sdnq b/extensions-builtin/sdnq index 92b86996d..c5d505a96 160000 --- a/extensions-builtin/sdnq +++ b/extensions-builtin/sdnq @@ -1 +1 @@ -Subproject commit 92b86996db0e4099087e790171bc122a968ddece +Subproject commit c5d505a96d8b38b411db78abbbe564c0dd8d42d3 diff --git a/launch.py b/launch.py index bb07fd696..8583f403b 100755 --- a/launch.py +++ b/launch.py @@ -216,6 +216,9 @@ def start_server(immediate=True, server=None): if args.test: from pipelines.generic_test import test_pipelines test_pipelines() + # log.info("Console test: \033[31m ANSI color red \033[0m") + # log.info("Console test: \033[34m ANSI color blue \033[0m") + # log.info("Console test: \033[33m ANSI color yellow \033[0m") log.info("Test only: exiting...") server.wants_restart = False uvicorn = server.webui(restart=not immediate, _exit=True) diff --git a/modules/logger.py b/modules/logger.py index 9ee604a10..544607a42 100644 --- a/modules/logger.py +++ b/modules/logger.py @@ -104,6 +104,8 @@ def setup_logging(debug=None, trace=None, filename=None): self.formatter = logging.Formatter('{ "asctime":"%(asctime)s", "created":%(created)f, "facility":"%(name)s", "pid":%(process)d, "tid":%(thread)d, "level":"%(levelname)s", "module":"%(module)s", "func":"%(funcName)s", "msg":"%(message)s" }') def strip(self, line): + if line is None: + return "" ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]') return ansi_escape.sub('', str(line)) @@ -143,6 +145,24 @@ def setup_logging(debug=None, trace=None, filename=None): def get(self): return self.buffer + class FileBuffer(RotatingFileHandler): + def __init__(self, filename, maxBytes=32*1024*1024, backupCount=9, encoding='utf-8', delay=True): + super().__init__(filename, maxBytes=maxBytes, backupCount=backupCount, encoding=encoding, delay=delay) + if trace: + self.formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)s | %(module)s:%(pathname)s:%(lineno)d:%(message)s') + else: + self.formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)s') + + def strip(self, line): + if line is None: + return "" + ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]') + return ansi_escape.sub('', str(line)) + + def emit(self, record): + record.msg = self.strip(record.msg) + super().emit(record) + class LogFilter(logging.Filter): def __init__(self): super().__init__() @@ -250,11 +270,7 @@ def setup_logging(debug=None, trace=None, filename=None): rh.setLevel(level) log.addHandler(rh) - fh = RotatingFileHandler(log_file, maxBytes=32*1024*1024, backupCount=9, encoding='utf-8', delay=True) # 10MB default for log rotation - if trace: - fh.formatter = logging.Formatter(f'%(asctime)s | {hostname} | %(name)s | %(levelname)s | %(module)s | | %(pathname)s:%(lineno)d | %(message)s') - else: - fh.formatter = logging.Formatter(f'%(asctime)s | {hostname} | %(name)s | %(levelname)s | %(module)s | %(message)s') + fh = FileBuffer(log_file) fh.addFilter(log_filter) fh.setLevel(logging.DEBUG) log.addHandler(fh) diff --git a/modules/video_models/google_veo.py b/modules/video_models/google_veo.py index cc1bc8ec0..d0c5b3666 100644 --- a/modules/video_models/google_veo.py +++ b/modules/video_models/google_veo.py @@ -60,7 +60,7 @@ class GoogleVeoVideoPipeline: ) def img2vid(self, prompt, image): - from google import genai + from google import genai # pylint: disable=no-name-in-module image_bytes = io.BytesIO() image.save(image_bytes, format='JPEG') return self.client.models.generate_videos( @@ -111,7 +111,7 @@ class GoogleVeoVideoPipeline: return args def __call__(self, prompt: list[str], width: int, height: int, image: Image.Image = None, num_frames: int = 4*24): - from google import genai + from google import genai # pylint: disable=no-name-in-module if isinstance(prompt, list) and len(prompt) > 0: prompt = prompt[0] diff --git a/requirements.txt b/requirements.txt index 500f1761b..0e99da630 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,7 +23,7 @@ httptools # versioned fastapi==0.124.4 -uvicorn==0.52.1 +uvicorn==0.52.4 rich==15.0.0 safetensors==0.8.0 peft==0.20.0 @@ -36,11 +36,11 @@ huggingface_hub==1.28.0 hf_xet==1.6.0 numpy==2.1.2 pandas==2.3.1 -protobuf==7.35.1 +protobuf==7.36.0 pytorch_lightning==2.6.5 urllib3==1.26.19 Pillow==12.2.0 -timm==1.0.27 +timm==1.0.28 pyparsing==3.3.2 typing-extensions==4.16.0 sentencepiece==0.2.1