aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-09 20:49:33 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-09 20:49:33 +0300
commitedfae9e78af23bdd6161c55c7ec88533de8925f8 (patch)
tree2659368f56fc6ba8616c53c6c9724140ced98859 /modules
parentc7b9394daf9efc5da8e56007199c3fc3e7439f92 (diff)
add --loglevel commandline argument for logging
remove the progressbar for extension installation in favor of logging output
Diffstat (limited to 'modules')
-rw-r--r--modules/cmd_args.py1
-rw-r--r--modules/initialize_util.py12
-rw-r--r--modules/launch_utils.py9
-rw-r--r--modules/logging_config.py16
4 files changed, 22 insertions, 16 deletions
diff --git a/modules/cmd_args.py b/modules/cmd_args.py
index 64f21e01..b0a11538 100644
--- a/modules/cmd_args.py
+++ b/modules/cmd_args.py
@@ -16,6 +16,7 @@ parser.add_argument("--test-server", action='store_true', help="launch.py argume
parser.add_argument("--log-startup", action='store_true', help="launch.py argument: print a detailed log of what's happening at startup")
parser.add_argument("--skip-prepare-environment", action='store_true', help="launch.py argument: skip all environment preparation")
parser.add_argument("--skip-install", action='store_true', help="launch.py argument: skip installation of packages")
+parser.add_argument("--loglevel", type=str, help="log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG", default=None)
parser.add_argument("--do-not-download-clip", action='store_true', help="do not download CLIP model even if it's not included in the checkpoint")
parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")
parser.add_argument("--config", type=str, default=sd_default_config, help="path to config which constructs model",)
diff --git a/modules/initialize_util.py b/modules/initialize_util.py
index e59bd3c4..d8370576 100644
--- a/modules/initialize_util.py
+++ b/modules/initialize_util.py
@@ -1,5 +1,4 @@
import json
-import logging
import os
import signal
import sys
@@ -7,17 +6,6 @@ import re
from modules.timer import startup_timer
-def setup_logging():
- # We can't use cmd_opts for this because it will not have been initialized at this point.
- log_level = os.environ.get("SD_WEBUI_LOG_LEVEL")
- if log_level:
- log_level = getattr(logging, log_level.upper(), None) or logging.INFO
- logging.basicConfig(
- level=log_level,
- format='%(asctime)s %(levelname)s [%(name)s] %(message)s',
- datefmt='%Y-%m-%d %H:%M:%S',
- )
-
def gradio_server_name():
from modules.shared_cmd_options import cmd_opts
diff --git a/modules/launch_utils.py b/modules/launch_utils.py
index 7143f144..90c00dd2 100644
--- a/modules/launch_utils.py
+++ b/modules/launch_utils.py
@@ -1,4 +1,5 @@
# this scripts installs necessary requirements and launches main program in webui.py
+import logging
import re
import subprocess
import os
@@ -11,8 +12,10 @@ from functools import lru_cache
from modules import cmd_args, errors
from modules.paths_internal import script_path, extensions_dir
from modules.timer import startup_timer
+from modules import logging_config
args, _ = cmd_args.parser.parse_known_args()
+logging_config.setup_logging(args.loglevel)
python = sys.executable
git = os.environ.get('GIT', "git")
@@ -248,10 +251,8 @@ def run_extensions_installers(settings_file):
return
with startup_timer.subcategory("run extensions installers"):
- import tqdm
- progress_bar = tqdm.tqdm(list_extensions(settings_file))
- for dirname_extension in progress_bar:
- progress_bar.set_description(f"Installing {dirname_extension}")
+ for dirname_extension in list_extensions(settings_file):
+ logging.debug(f"Installing {dirname_extension}")
path = os.path.join(extensions_dir, dirname_extension)
diff --git a/modules/logging_config.py b/modules/logging_config.py
new file mode 100644
index 00000000..7db23d4b
--- /dev/null
+++ b/modules/logging_config.py
@@ -0,0 +1,16 @@
+import os
+import logging
+
+
+def setup_logging(loglevel):
+ if loglevel is None:
+ loglevel = os.environ.get("SD_WEBUI_LOG_LEVEL")
+
+ if loglevel:
+ log_level = getattr(logging, loglevel.upper(), None) or logging.INFO
+ logging.basicConfig(
+ level=log_level,
+ format='%(asctime)s %(levelname)s [%(name)s] %(message)s',
+ datefmt='%Y-%m-%d %H:%M:%S',
+ )
+