Files
aitbc/aitbc/aitbc_logging.py
aitbc1 966056fdf9
All checks were successful
audit / audit (push) Has been skipped
ci-cd / build (push) Has been skipped
ci / build (push) Has been skipped
autofix / fix (push) Has been skipped
python-tests / test (push) Successful in 20s
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Has been skipped
test / test (push) Has been skipped
ci-cd / deploy (push) Has been skipped
ci / deploy (push) Has been skipped
fix: resolve circular import by renaming aitbc.logging module
CIRCULAR IMPORT FIX: Avoid conflict with Python built-in logging

Issue:
- aitbc/logging.py conflicts with Python's built-in logging module
- Circular import when pip tries to import logging
- AttributeError: partially initialized module 'logging' has no attribute 'Logger'

Solution:
- Rename aitbc/logging.py to aitbc/aitbc_logging.py
- Update aitbc/__init__.py to import from renamed module
- Maintains same API (get_logger, setup_logger)
- Avoids naming conflict with built-in logging

Expected results:
- No more circular import errors
- pip should work properly
- aitbc.logging imports should still work
- Test workflow should proceed to execution

This resolves the circular import that was blocking pip
and preventing the test workflow from running.
2026-03-27 21:06:16 +01:00

33 lines
861 B
Python

"""
AITBC Logging Module
Centralized logging utilities for the AITBC project
"""
import logging
import sys
from typing import Optional
def setup_logger(
name: str,
level: str = "INFO",
format_string: Optional[str] = None
) -> logging.Logger:
"""Setup a logger with consistent formatting"""
if format_string is None:
format_string = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
logger = logging.getLogger(name)
logger.setLevel(getattr(logging, level.upper()))
if not logger.handlers:
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(format_string)
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger
def get_logger(name: str) -> logging.Logger:
"""Get a logger instance"""
return logging.getLogger(name)