diff --git a/backend/src/infrastructure/dependencie_injection.py b/backend/src/infrastructure/dependencie_injection.py index 3027b40..0807217 100644 --- a/backend/src/infrastructure/dependencie_injection.py +++ b/backend/src/infrastructure/dependencie_injection.py @@ -9,7 +9,6 @@ class ApplicationDependencies: _instance = None def __new__(cls): - logger.info("🔧 Iniciando inicialização do ApplicationDependencies...") if cls._instance is None: logger.info("🚀 Criando nova instância de ApplicationDependencies") cls._instance = super().__new__(cls) diff --git a/backend/src/infrastructure/services/portfolio_data_service.py b/backend/src/infrastructure/services/portfolio_data_service.py index 5423c1b..af7e9d5 100644 --- a/backend/src/infrastructure/services/portfolio_data_service.py +++ b/backend/src/infrastructure/services/portfolio_data_service.py @@ -1,3 +1,4 @@ +import logging from src.domain.dto.certification import Certification from src.domain.dto.company_duration import CompanyDuration from src.domain.dto.experience import Experience @@ -8,6 +9,8 @@ from src.infrastructure.ports.cache_provider_interface import CacheProvider +logger = logging.getLogger(__name__) + class PortfolioDataService: """Portfolio Data Service""" @@ -20,10 +23,13 @@ def projects(self) -> list[Project]: cache_projects = self.cache_provider.get_all_projects() if cache_projects: + logger.info(f"✅ [CACHE HIT] {len(cache_projects)} projetos recuperados do cache") return cache_projects + logger.warning("⚠️ [CACHE MISS] Dados de projetos não encontrados no cache. Buscando no repositório...") repository_projects = self.data_repository.get_all_projects() - + + logger.info(f"💾 Salvando {len(repository_projects)} projetos no cache...") self.cache_provider.set_projects(repository_projects) return repository_projects @@ -33,12 +39,14 @@ def experiences(self) -> list[Experience]: """Get experiences data from the repository.""" cache_experiences = self.cache_provider.get_all_experiences() - if cache_experiences: + logger.info(f"✅ [CACHE HIT] {len(cache_experiences)} experiências recuperadas do cache") return cache_experiences + logger.warning("⚠️ [CACHE MISS] Dados de experiências não encontrados no cache. Buscando no repositório...") repository_experiences = self.data_repository.get_all_experiences() - + + logger.info(f"💾 Salvando {len(repository_experiences)} experiências no cache...") self.cache_provider.set_experiences(repository_experiences) return repository_experiences @@ -47,10 +55,13 @@ def companies_duration(self) -> list[CompanyDuration]: cached_companies_duration = self.cache_provider.get_company_duration() if cached_companies_duration: + logger.info("✅ [CACHE HIT] Durações de empresas recuperadas do cache") return cached_companies_duration + logger.warning("⚠️ [CACHE MISS] Dados de duração de empresas não encontrados no cache. Buscando no repositório...") repository_companies_duration = self.data_repository.get_company_duration() - + + logger.info("💾 Salvando durações de empresas no cache...") self.cache_provider.set_company_duration(repository_companies_duration) return repository_companies_duration @@ -60,10 +71,13 @@ def formations(self) -> list[Formation]: cached_formations = self.cache_provider.get_all_formations() if cached_formations: + logger.info(f"✅ [CACHE HIT] {len(cached_formations)} formações recuperadas do cache") return cached_formations + logger.warning("⚠️ [CACHE MISS] Dados de formações não encontrados no cache. Buscando no repositório...") repository_formations = self.data_repository.get_all_formations() - + + logger.info(f"💾 Salvando {len(repository_formations)} formações no cache...") self.cache_provider.set_formations(repository_formations) return repository_formations @@ -73,10 +87,13 @@ def certifications(self) -> list[Certification]: cached_certifications = self.cache_provider.get_all_certifications() if cached_certifications: + logger.info(f"✅ [CACHE HIT] {len(cached_certifications)} certificações recuperadas do cache") return cached_certifications + logger.warning("⚠️ [CACHE MISS] Dados de certificações não encontrados no cache. Buscando no repositório...") repository_certifications = self.data_repository.get_all_certifications() - + + logger.info(f"💾 Salvando {len(repository_certifications)} certificações no cache...") self.cache_provider.set_certifications(repository_certifications) return repository_certifications @@ -86,10 +103,13 @@ def social_media(self) -> list[SocialMedia]: cached_social_media = self.cache_provider.get_all_social_media() if cached_social_media: + logger.info(f"✅ [CACHE HIT] {len(cached_social_media)} redes sociais recuperadas do cache") return cached_social_media + logger.warning("⚠️ [CACHE MISS] Dados de redes sociais não encontrados no cache. Buscando no repositório...") repository_social_media = self.data_repository.get_all_social_media() - + + logger.info(f"💾 Salvando {len(repository_social_media)} redes sociais no cache...") self.cache_provider.set_social_media(repository_social_media) return repository_social_media @@ -99,10 +119,13 @@ def total_experience(self) -> dict: cached_total_experience = self.cache_provider.get_total_experience() if cached_total_experience: + logger.info("✅ [CACHE HIT] Experiência total recuperada do cache") return cached_total_experience + logger.warning("⚠️ [CACHE MISS] Dados de experiência total não encontrados no cache. Buscando no repositório...") repository_total_experience = self.data_repository.get_total_experience() - + + logger.info("💾 Salvando experiência total no cache...") self.cache_provider.set_total_experience(repository_total_experience) return repository_total_experience