Logging: set formatter correctly for fallback logger too

This commit is contained in:
Aarni Koskela 2024-01-11 08:29:42 +02:00
parent 85bf2eb441
commit 0011640ab1

View File

@ -36,20 +36,21 @@ def setup_logging(loglevel):
# Already configured, do not interfere
return
formatter = logging.Formatter(
'%(asctime)s %(levelname)s [%(name)s] %(message)s',
'%Y-%m-%d %H:%M:%S',
)
if os.environ.get("SD_WEBUI_RICH_LOG"):
from rich.logging import RichHandler
handler = RichHandler()
else:
handler = logging.StreamHandler()
handler.setFormatter(formatter)
if TqdmLoggingHandler:
handler = TqdmLoggingHandler(handler)
formatter = logging.Formatter(
'%(asctime)s %(levelname)s [%(name)s] %(message)s',
'%Y-%m-%d %H:%M:%S',
)
handler.setFormatter(formatter)
log_level = getattr(logging, loglevel.upper(), None) or logging.INFO