Skip to content

Commit

Permalink
set propagate to false before checking hasHandlers
Browse files Browse the repository at this point in the history
  • Loading branch information
shuangwu5 committed Feb 18, 2025
1 parent a8df2ee commit 864743b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mostlyai/qa/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ def init_logging() -> None:
Initialize the logging configuration to stdout.
"""

# log to stdout
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(logging.Formatter("[%(asctime)s] %(levelname)-7s: %(message)s"))
handler.setLevel(logging.INFO)

_LOG.propagate = False
if not _LOG.hasHandlers():
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(logging.Formatter("[%(asctime)s] %(levelname)-7s: %(message)s"))
handler.setLevel(logging.INFO)
_LOG.addHandler(handler)
_LOG.setLevel(logging.INFO)
_LOG.propagate = False

0 comments on commit 864743b

Please sign in to comment.