2021.4 #19

Merged
edraft merged 237 commits from 2021.4 into master 2021-04-01 10:13:33 +02:00
2 changed files with 12 additions and 0 deletions
Showing only changes of commit 31fe1c5cd7 - Show all commits

View File

@ -8,6 +8,8 @@ from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC
from cpl.dependency_injection.service_descriptor import ServiceDescriptor
from cpl.dependency_injection.service_lifetime_enum import ServiceLifetimeEnum
from cpl.dependency_injection.service_provider import ServiceProvider
from cpl.logging.logger_service import Logger
from cpl.logging.logger_abc import LoggerABC
from cpl.utils.credential_manager import CredentialManager
@ -39,6 +41,9 @@ class ServiceCollection(ServiceCollectionABC):
self._database_context = db_context_type(db_settings)
self._database_context.connect(CredentialManager.build_string(db_settings.connection_string, db_settings.credentials))
def add_logging(self):
self.add_singleton(LoggerABC, Logger)
def add_singleton(self, service_type: Union[type, object], service: Union[type, object] = None):
impl = None
if service is not None:

View File

@ -26,6 +26,13 @@ class ServiceCollectionABC(ABC):
"""
pass
@abstractmethod
def add_logging(self):
"""
Adds the CPL internal logger
"""
pass
@abstractmethod
def add_transient(self, service_type: Type, service: Callable = None):
"""