Improved testing and service providing
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
from abc import abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
from sh_edraft.configuration.application_host import ApplicationHost
|
||||
from sh_edraft.logging.model.log_settings import LoggingSettings
|
||||
from sh_edraft.configuration import ApplicationHost
|
||||
from sh_edraft.logging.model.logging_settings import LoggingSettings
|
||||
from sh_edraft.service.base.service_base import ServiceBase
|
||||
from sh_edraft.time.model.time_format_settings import TimeFormatSettings
|
||||
|
||||
@@ -10,12 +9,11 @@ from sh_edraft.time.model.time_format_settings import TimeFormatSettings
|
||||
class LoggerBase(ServiceBase):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self):
|
||||
def __init__(self, logging_settings: LoggingSettings, time_format: TimeFormatSettings):
|
||||
ServiceBase.__init__(self)
|
||||
|
||||
self._log_settings: Optional[LoggingSettings] = None
|
||||
self._time_format_settings: Optional[TimeFormatSettings] = None
|
||||
self._app_host: Optional[ApplicationHost] = None
|
||||
self._log_settings: LoggingSettings = logging_settings
|
||||
self._time_format_settings: TimeFormatSettings = time_format
|
||||
|
||||
@abstractmethod
|
||||
def header(self, string: str): pass
|
||||
|
@@ -1,28 +1,23 @@
|
||||
import datetime
|
||||
import os
|
||||
import traceback
|
||||
from collections import Callable
|
||||
from string import Template
|
||||
from typing import Optional
|
||||
|
||||
from sh_edraft.configuration import ApplicationHost
|
||||
from sh_edraft.logging.base.logger_base import LoggerBase
|
||||
from sh_edraft.logging.model.log_level import LoggingLevel
|
||||
from sh_edraft.logging.model import LoggingSettings
|
||||
from sh_edraft.logging.model.logging_level import LoggingLevel
|
||||
from sh_edraft.time.model import TimeFormatSettings
|
||||
from sh_edraft.utils.console import Console
|
||||
|
||||
|
||||
class Logger(LoggerBase):
|
||||
|
||||
def __init__(self):
|
||||
LoggerBase.__init__(self)
|
||||
def __init__(self, logging_settings: LoggingSettings, time_format: TimeFormatSettings, app_host: ApplicationHost):
|
||||
LoggerBase.__init__(self, logging_settings, time_format)
|
||||
|
||||
self._log: Optional[str] = None
|
||||
self._path: Optional[str] = None
|
||||
self._level: Optional[LoggingLevel] = None
|
||||
self._console: Optional[LoggingLevel] = None
|
||||
|
||||
def init(self, args: tuple):
|
||||
self._log_settings = args[0]
|
||||
self._time_format_settings = args[1]
|
||||
self._app_host = args[2]
|
||||
self._app_host: ApplicationHost = app_host
|
||||
|
||||
self._log = Template(self._log_settings.filename).substitute(
|
||||
date_time_now=self._app_host.date_time_now.strftime(self._time_format_settings.date_time_format),
|
||||
|
@@ -20,8 +20,8 @@ __version__ = '2020.12.5'
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
from .log_level import LoggingLevel
|
||||
from .log_settings import LoggingSettings
|
||||
from .logging_level import LoggingLevel
|
||||
from .logging_settings import LoggingSettings
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major=2020, minor=12, micro=5)
|
||||
|
@@ -2,9 +2,9 @@ import traceback
|
||||
from typing import Optional
|
||||
|
||||
from sh_edraft.configuration.model.configuration_model_base import ConfigurationModelBase
|
||||
from sh_edraft.logging.model.log_settings_name import LogSettingsName
|
||||
from sh_edraft.logging.model.logging_settings_name import LogSettingsName
|
||||
from sh_edraft.utils.console import Console
|
||||
from sh_edraft.logging.model.log_level import LoggingLevel
|
||||
from sh_edraft.logging.model.logging_level import LoggingLevel
|
||||
|
||||
|
||||
class LoggingSettings(ConfigurationModelBase):
|
Reference in New Issue
Block a user