refactor: remove GlobalLogger and migrate to standard Python logging

- Remove src/infrastructure/logging/GlobalLogger.py
- Update SerieScanner.py to use standard logging.getLogger()
- Update aniworld_provider.py to remove custom noKeyFound_logger setup
- Fix test_dependencies.py to properly mock config_service
- Fix code style issues (line length, formatting)
- All 846 tests passing
This commit is contained in:
2025-10-25 17:27:49 +02:00
parent a3651e0e47
commit a41c86f1da
17 changed files with 447 additions and 135 deletions

View File

@@ -23,9 +23,10 @@ from src.core.interfaces.callbacks import (
ProgressPhase,
)
from src.core.providers.base_provider import Loader
from src.infrastructure.logging.GlobalLogger import error_logger, noKeyFound_logger
logger = logging.getLogger(__name__)
error_logger = logging.getLogger("error")
no_key_found_logger = logging.getLogger("series.nokey")
class SerieScanner:
@@ -174,7 +175,7 @@ class SerieScanner:
# remote metadata, yielding missing episodes per
# season. Results are saved back to disk so that both
# CLI and API consumers see consistent state.
missing_episodes, site = (
missing_episodes, _site = (
self.__get_missing_episodes_and_season(
serie.key, mp4_files
)
@@ -192,14 +193,14 @@ class SerieScanner:
)
else:
self.folderDict[serie.key] = serie
noKeyFound_logger.info(
no_key_found_logger.info(
"Saved Serie: '%s'", str(serie)
)
except NoKeyFoundException as nkfe:
# Log error and notify via callback
error_msg = f"Error processing folder '{folder}': {nkfe}"
NoKeyFoundException.error(error_msg)
logger.error(error_msg)
self._callback_manager.notify_error(
ErrorContext(

View File

@@ -46,12 +46,7 @@ if not download_error_logger.handlers:
download_error_handler.setLevel(logging.ERROR)
download_error_logger.addHandler(download_error_handler)
noKeyFound_logger = logging.getLogger("NoKeyFound")
if not noKeyFound_logger.handlers:
log_path = _logs_dir / "no_key_found.log"
noKeyFound_handler = logging.FileHandler(str(log_path))
noKeyFound_handler.setLevel(logging.ERROR)
noKeyFound_logger.addHandler(noKeyFound_handler)
noKeyFound_logger = logging.getLogger()
class AniworldLoader(Loader):