fix logger

This commit is contained in:
Vladimir Mandic
2023-04-19 14:11:25 -04:00
parent 955b841d0f
commit 93a9e7ba16
7 changed files with 21 additions and 48 deletions
+3 -40
View File
@@ -4,15 +4,14 @@
Stuff to be fixed...
- Fix integration with <https://github.com/kohya-ss/sd-webui-additional-networks>
- Fix integration with <https://github.com/deforum-art/deforum-for-automatic1111-webui>
- Create new GitHub hooks/actions for CI/CD
- Clean-up server state after on-the-fly restart (e.g., impacts read gen data)
## Features
Stuff to be added...
- Create new GitHub hooks/actions for CI/CD
- Move Restart Server from WebUI to Launch and reload modules
- Redo Extensions tab: see <https://vladmandic.github.io/sd-extension-manager/pages/extensions.html>
- Stream-load models as option for slow storage
- Replace **PngInfo** / **EXIF** metadata handler
@@ -30,43 +29,7 @@ Stuff to be investigated...
Pick & merge PRs from main repo...
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/7595>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/8608>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/8611>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/8665>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/8741>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/8742>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9128>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9134>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9155>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9177>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9211>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9212>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9219>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9227>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9249>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9256>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9258>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9295>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9312>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9314>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9315>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9319>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9392>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9407>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9451>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9491>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9504>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9513>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9542>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9592>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9628>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9669>
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9677>
Complete:
- <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/8945>
- Merge backlog: <https://github.com/vladmandic/automatic/pulls>
## Models
+2 -3
View File
@@ -12,13 +12,12 @@ from fastapi.exceptions import HTTPException
from fastapi.encoders import jsonable_encoder
import modules.errors as errors
logging.disable(logging.CRITICAL)
errors.install()
def setup_middleware(app: FastAPI, cmd_opts):
print('Initializing middleware')
# uvicorn_logger=logging.getLogger("uvicorn.error")
# uvicorn_logger.disabled = True
uvicorn_logger=logging.getLogger("uvicorn.error")
uvicorn_logger.disabled = True
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
app.user_middleware = [x for x in app.user_middleware if x.cls.__name__ != 'CORSMiddleware']
+3 -2
View File
@@ -14,12 +14,11 @@ import modules.devices as devices
from modules import script_loading, errors, ui_components, shared_items, cmd_args
from modules.paths_internal import models_path, script_path, data_path, sd_configs_path, sd_default_config, sd_model_file, default_sd_model_file, extensions_dir, extensions_builtin_dir # pylint: disable=W0611
import modules.paths_internal as paths
from setup import log as setup_log # pylint: disable=E0611
errors.install(gr)
demo: gr.Blocks = None
log = setup_log
parser = cmd_args.parser
script_loading.preload_extensions(paths.extensions_dir, parser)
@@ -683,6 +682,8 @@ def restart_server():
if demo is None:
return
try:
import logging
logging.disable(logging.CRITICAL)
demo.server.should_exit = True
demo.server.force_exit = True
demo.close(verbose=False)
+1
View File
@@ -48,6 +48,7 @@ def setup_logging(clean=False):
pretty_install(console=console)
traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, suppress=[])
rh = RichHandler(show_time=True, omit_repeated_times=False, show_level=True, show_path=False, markup=False, rich_tracebacks=True, log_time_format='%H:%M:%S-%f', level=logging.DEBUG if args.debug else logging.INFO, console=console)
rh.set_name(logging.DEBUG if args.debug else logging.INFO)
log.addHandler(rh)
except:
sh = logging.StreamHandler()
+10 -1
View File
@@ -9,7 +9,6 @@ from modules import timer, errors
startup_timer = timer.Timer()
logging.basicConfig(level=logging.WARNING, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s', force=True) # reset logging
import torch # pylint: disable=C0411
import torchvision # pylint: disable=W0611,C0411
import pytorch_lightning # pytorch_lightning should be imported after torch, but it re-enables warnings on import so import once to disable them # pylint: disable=W0611,C0411
@@ -152,6 +151,7 @@ def create_api(app):
def start_ui():
logging.disable(logging.INFO)
initialize()
ui_tempdir.on_tmpdir_changed()
if shared.opts.clean_temp_dir_at_start:
@@ -201,6 +201,7 @@ def start_ui():
def webui():
start_ui()
load_model()
print(f"Startup time: {startup_timer.summary()}")
@@ -216,6 +217,14 @@ def webui():
print(f"Startup time: {startup_timer.summary()}")
time.sleep(1)
"""
import sys
import types
from modules.paths_internal import script_path
libs = [name for name, m in sys.modules.items() if isinstance(m, types.ModuleType) and (getattr(m, '__file__', '') or '').startswith(script_path)]
print(libs)
"""
if __name__ == "__main__":
webui()