aboutsummaryrefslogtreecommitdiffstats
path: root/modules/logging_config.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-10 14:04:38 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-10 14:04:38 +0000
commit70a01cd4440d708bf25cc50393c0430935a8ebc2 (patch)
treedaad07800a3dadfd3caeac1383c1c65ecfcb6284 /modules/logging_config.py
parent1aefb5025929818b2a96cbb6148fcc2db7b947ec (diff)
parent070b034cd5b49eb5056a18b43f88aa223fec9e0b (diff)
downloadstable-diffusion-webui-gfx803-70a01cd4440d708bf25cc50393c0430935a8ebc2.tar.gz
stable-diffusion-webui-gfx803-70a01cd4440d708bf25cc50393c0430935a8ebc2.tar.bz2
stable-diffusion-webui-gfx803-70a01cd4440d708bf25cc50393c0430935a8ebc2.zip
Merge branch 'dev' into refiner
Diffstat (limited to 'modules/logging_config.py')
-rw-r--r--modules/logging_config.py16
1 files changed, 16 insertions, 0 deletions
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',
+ )
+