Skip to content

Commit

Permalink
chore: Remove logging hack (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkram authored Sep 30, 2024
1 parent 6e47587 commit 8dda75f
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions binstar_client/utils/logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,13 @@ def format(self, record: logging.LogRecord) -> str:
return super().format(record)


try:
from rich.logging import RichHandler
except (ImportError, ModuleNotFoundError):
RichHandler = None # type: ignore


def _purge_rich_handler_from_logging_root() -> None:
# Remove all handlers associated with the root logger object.
# We do this since anaconda-cli-base defines the RichHandler, which conflicts with anaconda-client's logging
# We can remove this once we clean up logging.
for handler in logging.root.handlers[:]:
# Only remove the root RichHandler, and only if rich is installed
# This should always happen, but just being super careful here.
if RichHandler is not None and isinstance(handler, RichHandler):
logging.root.removeHandler(handler)


def setup_logging(
logger: logging.Logger,
log_level: int = logging.INFO,
show_traceback: bool = False,
disable_ssl_warnings: bool = False
) -> None:
"""Configure logging for the application."""
_purge_rich_handler_from_logging_root()
logger.setLevel(logging.DEBUG)

os.makedirs(config.USER_LOGDIR, exist_ok=True)
Expand Down

0 comments on commit 8dda75f

Please sign in to comment.