ISSUES RESOLVED: 1. Coordinator API unnecessary nesting BEFORE: /apps/coordinator-api/aitbc/api/v1/settlement.py AFTER: /apps/coordinator-api/src/app/routers/settlement.py - Moved settlement code to proper router location - Moved logging.py to main app directory - Integrated settlement functionality into main FastAPI app - Removed duplicate /aitbc/ directory 2. AITBC Core package structure ANALYZED: /packages/py/aitbc-core/src/aitbc/ STATUS: ✅ Kept as-is (proper Python packaging) - src/aitbc/ is standard Python package structure - No unnecessary nesting detected - Follows Poetry best practices LEGITIMATE DIRECTORIES (NO CHANGES): - /cli/debian/etc/aitbc (Debian package structure) - /cli/debian/usr/share/aitbc (Debian package structure) - Node modules and virtual environments BENEFITS: - Eliminated duplicate code locations - Integrated settlement functionality into main app - Cleaner coordinator-api structure - Reduced confusion in codebase organization - Maintained proper Python packaging standards VERIFICATION: ✅ No more problematic 'aitbc' directories ✅ All code properly organized ✅ Standard package structures maintained ✅ No functionality lost in refactoring
32 lines
832 B
Python
Executable File
32 lines
832 B
Python
Executable File
"""
|
|
Logging utilities for AITBC coordinator API
|
|
"""
|
|
|
|
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)
|