Skip to content

Commit

Permalink
only reconfigure this once
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Oct 21, 2024
1 parent c41247e commit e5f8cd8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bfabric/cli_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ class HostnameHighlighter(RegexHighlighter):

def setup_script_logging(debug: bool = False) -> None:
"""Sets up the logging for the command line scripts."""
setup_flag_key = "BFABRICPY_SCRIPT_LOGGING_SETUP"
if os.environ.get(setup_flag_key, "0") == "1":
return
logger.remove()
if not (debug or os.environ.get("BFABRICPY_DEBUG")):
logger.add(sys.stderr, filter="bfabric", level="INFO", format="{level} {message}")
logger.add(sys.stderr, filter="__main__", level="INFO", format="{level} {message}")
else:
logger.add(sys.stderr, filter="bfabric", level="DEBUG")
logger.add(sys.stderr, filter="__main__", level="DEBUG")
os.environ[setup_flag_key] = "1"

0 comments on commit e5f8cd8

Please sign in to comment.