Bugfixes in logger
This commit is contained in:
parent
e76b293f60
commit
0df6d469ab
@ -146,9 +146,9 @@ class Logger(LoggerBase):
|
|||||||
if ex is not None:
|
if ex is not None:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
self.error(name, message)
|
self.error(name, message)
|
||||||
output = self._get_string(name, LoggingLevel.ERROR, f'{ex} -> {tb}')
|
output = self._get_string(name, LoggingLevel.FATAL, f'{ex} -> {tb}')
|
||||||
else:
|
else:
|
||||||
output = self._get_string(name, LoggingLevel.ERROR, message)
|
output = self._get_string(name, LoggingLevel.FATAL, message)
|
||||||
|
|
||||||
# check if message can be written to log
|
# check if message can be written to log
|
||||||
if self._level.value >= LoggingLevel.FATAL.value:
|
if self._level.value >= LoggingLevel.FATAL.value:
|
||||||
|
@ -210,4 +210,4 @@ class LoggerTest(unittest.TestCase):
|
|||||||
print('Cannot open log file', e)
|
print('Cannot open log file', e)
|
||||||
|
|
||||||
self.assertGreater(len(log_content), 0)
|
self.assertGreater(len(log_content), 0)
|
||||||
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ ERROR ] [ {__name__} ]: {__name__}.test_fatal:\n'))
|
self.assertTrue(log_content[len(log_content) - 1].endswith(f'[ FATAL ] [ {__name__} ]: {__name__}.test_fatal:\n'))
|
||||||
|
Loading…
Reference in New Issue
Block a user