diff --git a/server/services/core/config_service.py b/server/services/core/config_service.py index 4237c37..a1b8c35 100644 --- a/server/services/core/config_service.py +++ b/server/services/core/config_service.py @@ -1,3 +1,5 @@ +import logging + from kink import inject from sqlalchemy import delete @@ -13,24 +15,38 @@ @inject(alias=ConfigServiceProtocol) class ConfigService(ConfigServiceProtocol): def __init__(self, db_service: DBService): + self.logger = logging.getLogger(__name__) self._db_service = db_service + self.logger.info("ConfigService initialized") + def get(self, key: str) -> str | None: + self.logger.info(f"Getting config: {key}") with self._db_service.get_session() as session: result: ConfigTable | None = session.get( ConfigTable, key ) + self.logger.info(f"Got config {key}: {result}") return result.value if result else None def set(self, key: str, value: str): + self.logger.info( + f"Setting config: {key} to {value}" + ) with self._db_service.get_session() as session: session.merge(ConfigTable(key=key, value=value)) session.commit() + self.logger.info(f"Set config {key} to {value}") + def delete(self, key: str): + self.logger.info(f"Deleting config: {key}") with self._db_service.get_session() as session: item = session.get(ConfigTable, key) if not item: + self.logger.info( + f"Config {key} not found, ignoring delete" + ) return session.execute( delete(ConfigTable).where( @@ -39,5 +55,7 @@ def delete(self, key: str): ) session.commit() + self.logger.info(f"Deleted config {key}") + __all__ = ["ConfigService"] diff --git a/server/services/core/workspace_metadata_service.py b/server/services/core/workspace_metadata_service.py index eb78e59..d36439f 100644 --- a/server/services/core/workspace_metadata_service.py +++ b/server/services/core/workspace_metadata_service.py @@ -30,6 +30,10 @@ def __init__(self, db_service: DBService): ) self._db_service: DBService = db_service + self.logger.info( + "WorkspaceMetadataService initialized" + ) + def get_workspace_metadata( self, uuid: str, diff --git a/server/services/local/local_fs_service.py b/server/services/local/local_fs_service.py index a8e813b..ccd6cce 100644 --- a/server/services/local/local_fs_service.py +++ b/server/services/local/local_fs_service.py @@ -34,6 +34,10 @@ def __init__( ) self._FILE_DIR.mkdir() + self.logger.info( + f"LocalFSService initialized with file directory {self._FILE_DIR}" + ) + def upload_file( self, name: str, diff --git a/server/services/local/local_mapping_service.py b/server/services/local/local_mapping_service.py new file mode 100644 index 0000000..11ccaf1 --- /dev/null +++ b/server/services/local/local_mapping_service.py @@ -0,0 +1,15 @@ +import logging + +from kink import inject + +from server.service_protocols.mapping_service_protocol import ( + MappingServiceProtocol, +) + + +@inject(alias=MappingServiceProtocol) +class LocalMappingService(MappingServiceProtocol): + def __init__(self) -> None: + self.logger = logging.getLogger(__name__) + + self.logger.info("LocalMappingService initialized") diff --git a/server/services/local/local_ontology_service.py b/server/services/local/local_ontology_service.py index 97d8b43..5b67560 100644 --- a/server/services/local/local_ontology_service.py +++ b/server/services/local/local_ontology_service.py @@ -40,6 +40,8 @@ def __init__( self.fs_service: FSServiceProtocol = fs_service self.db_service: DBService = db_service + self.logger.info("LocalOntologyService initialized") + def _get_from_ontology_table( self, ontology_id: str ) -> OntologyTable | None: diff --git a/server/services/local/local_source_service.py b/server/services/local/local_source_service.py index 06dc21f..0c7131f 100644 --- a/server/services/local/local_source_service.py +++ b/server/services/local/local_source_service.py @@ -28,6 +28,8 @@ def __init__( self.fs_service = fs_service self.logger = logging.getLogger(__name__) + self.logger.info("LocalSourceService initialized") + def get_source(self, source_id: str) -> Source: self.logger.info(f"Getting source {source_id}") diff --git a/server/services/local/local_workspace_service.py b/server/services/local/local_workspace_service.py index 0284b5b..74f5abf 100644 --- a/server/services/local/local_workspace_service.py +++ b/server/services/local/local_workspace_service.py @@ -19,6 +19,10 @@ def __init__(self, fs_service: LocalFSService): self.logger = logging.getLogger(__name__) self._fs_service: LocalFSService = fs_service + self.logger.info( + "LocalWorkspaceService initialized" + ) + def get_workspace( self, location: str ) -> WorkspaceModel: