Skip to content

Commit

Permalink
Merge pull request #14618 from akx/log-fmt-fix
Browse files Browse the repository at this point in the history
Logging: set formatter correctly for fallback logger too
  • Loading branch information
AUTOMATIC1111 committed Jan 11, 2024
2 parents 85bf2eb + 0011640 commit cb5b335
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb5b335

Please sign in to comment.