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 57 additions and 50 deletions
Showing only changes of commit 9e7c6a695f - Show all commits

View File

@ -10,22 +10,72 @@ class LoggerABC(ServiceABC):
ServiceABC.__init__(self) ServiceABC.__init__(self)
@abstractmethod @abstractmethod
def header(self, string: str): pass def header(self, string: str):
"""
Writes a header message
:param string:
:return:
"""
pass
@abstractmethod @abstractmethod
def trace(self, name: str, message: str): pass def trace(self, name: str, message: str):
"""
Writes a trace message
:param name:
:param message:
:return:
"""
pass
@abstractmethod @abstractmethod
def debug(self, name: str, message: str): pass def debug(self, name: str, message: str):
"""
Writes a debug message
:param name:
:param message:
:return:
"""
pass
@abstractmethod @abstractmethod
def info(self, name: str, message: str): pass def info(self, name: str, message: str):
"""
Writes an information
:param name:
:param message:
:return:
"""
pass
@abstractmethod @abstractmethod
def warn(self, name: str, message: str): pass def warn(self, name: str, message: str):
"""
Writes an warning
:param name:
:param message:
:return:
"""
pass
@abstractmethod @abstractmethod
def error(self, name: str, message: str, ex: Exception = None): pass def error(self, name: str, message: str, ex: Exception = None):
"""
Writes an error
:param name:
:param message:
:param ex:
:return:
"""
pass
@abstractmethod @abstractmethod
def fatal(self, name: str, message: str, ex: Exception = None): pass def fatal(self, name: str, message: str, ex: Exception = None):
"""
Writes an error and exits
:param name:
:param message:
:param ex:
:return:
"""
pass

View File

@ -110,11 +110,6 @@ class Logger(LoggerABC):
return f'<{self._get_datetime_now()}> [ {log_level} ] [ {name} ]: {message}' return f'<{self._get_datetime_now()}> [ {log_level} ] [ {name} ]: {message}'
def header(self, string: str): def header(self, string: str):
"""
Writes a header message
:param string:
:return:
"""
# append log and print message # append log and print message
self._append_log(string) self._append_log(string)
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
@ -122,12 +117,6 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def trace(self, name: str, message: str): def trace(self, name: str, message: str):
"""
Writes a trace message
:param name:
:param message:
:return:
"""
output = self._get_string(name, LoggingLevelEnum.TRACE, message) output = self._get_string(name, LoggingLevelEnum.TRACE, message)
# check if message can be written to log # check if message can be written to log
@ -141,12 +130,6 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def debug(self, name: str, message: str): def debug(self, name: str, message: str):
"""
Writes a debug message
:param name:
:param message:
:return:
"""
output = self._get_string(name, LoggingLevelEnum.DEBUG, message) output = self._get_string(name, LoggingLevelEnum.DEBUG, message)
# check if message can be written to log # check if message can be written to log
@ -160,12 +143,6 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def info(self, name: str, message: str): def info(self, name: str, message: str):
"""
Writes an information
:param name:
:param message:
:return:
"""
output = self._get_string(name, LoggingLevelEnum.INFO, message) output = self._get_string(name, LoggingLevelEnum.INFO, message)
# check if message can be written to log # check if message can be written to log
@ -179,12 +156,6 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def warn(self, name: str, message: str): def warn(self, name: str, message: str):
"""
Writes an warning
:param name:
:param message:
:return:
"""
output = self._get_string(name, LoggingLevelEnum.WARN, message) output = self._get_string(name, LoggingLevelEnum.WARN, message)
# check if message can be written to log # check if message can be written to log
@ -198,13 +169,6 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def error(self, name: str, message: str, ex: Exception = None): def error(self, name: str, message: str, ex: Exception = None):
"""
Writes an error
:param name:
:param message:
:param ex:
:return:
"""
output = '' output = ''
if ex is not None: if ex is not None:
tb = traceback.format_exc() tb = traceback.format_exc()
@ -224,13 +188,6 @@ class Logger(LoggerABC):
Console.set_foreground_color(ForegroundColorEnum.default) Console.set_foreground_color(ForegroundColorEnum.default)
def fatal(self, name: str, message: str, ex: Exception = None): def fatal(self, name: str, message: str, ex: Exception = None):
"""
Writes an error and exits
:param name:
:param message:
:param ex:
:return:
"""
output = '' output = ''
if ex is not None: if ex is not None:
tb = traceback.format_exc() tb = traceback.format_exc()