Skip to content

Commit

Permalink
WIP: idempotency of setup logger
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc committed Dec 24, 2024
1 parent 3b97984 commit fc2a01c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion anta/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ def setup_logging(level: LogLevel = Log.INFO, file: Path | None = None) -> None:
# httpx as well
logging.getLogger("httpx").setLevel(logging.WARNING)

# Add RichHandler for stdout
# Add RichHandler for stdout if not already present
if root.hasHandlers():
logger.handlers = []

root.

rich_handler = RichHandler(markup=True, rich_tracebacks=True, tracebacks_show_locals=False)
# Show Python module in stdout at DEBUG level
fmt_string = "[grey58]\\[%(name)s][/grey58] %(message)s" if loglevel == logging.DEBUG else "%(message)s"
Expand Down

0 comments on commit fc2a01c

Please sign in to comment.