Logging: set formatter correctly for fallback logger too
This commit is contained in:
parent
85bf2eb441
commit
0011640ab1
|
@ -36,20 +36,21 @@ def setup_logging(loglevel):
|
||||||
# Already configured, do not interfere
|
# Already configured, do not interfere
|
||||||
return
|
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"):
|
if os.environ.get("SD_WEBUI_RICH_LOG"):
|
||||||
from rich.logging import RichHandler
|
from rich.logging import RichHandler
|
||||||
handler = RichHandler()
|
handler = RichHandler()
|
||||||
else:
|
else:
|
||||||
handler = logging.StreamHandler()
|
handler = logging.StreamHandler()
|
||||||
|
handler.setFormatter(formatter)
|
||||||
|
|
||||||
if TqdmLoggingHandler:
|
if TqdmLoggingHandler:
|
||||||
handler = TqdmLoggingHandler(handler)
|
handler = TqdmLoggingHandler(handler)
|
||||||
|
|
||||||
formatter = logging.Formatter(
|
|
||||||
'%(asctime)s %(levelname)s [%(name)s] %(message)s',
|
|
||||||
'%Y-%m-%d %H:%M:%S',
|
|
||||||
)
|
|
||||||
|
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
|
|
||||||
log_level = getattr(logging, loglevel.upper(), None) or logging.INFO
|
log_level = getattr(logging, loglevel.upper(), None) or logging.INFO
|
||||||
|
|
Loading…
Reference in New Issue