Fixed logger format

This commit is contained in:
Dimitris Zlatanidis 2023-06-29 16:46:48 +03:00
parent 3d501e9cb3
commit eb39ec0a3d

View file

@ -131,8 +131,10 @@ class Utilities(Configs):
yield package
except FileNotFoundError:
logger = logging.getLogger(LoggingConfig.date_time)
logger.exception(f'{self.__class__.__name__}: '
f'{self.__class__.read_packages_from_file.__name__}')
logger.exception(
f'{self.__class__.__name__}: '
f'{self.__class__.read_packages_from_file.__name__}'
)
self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20)
def read_text_file(self, file: Path) -> list:
@ -142,8 +144,10 @@ class Utilities(Configs):
return text_file.readlines()
except FileNotFoundError:
logger = logging.getLogger(LoggingConfig.date_time)
logger.exception(f'{self.__class__.__name__}: '
f'{self.__class__.read_text_file.__name__}')
logger.exception(
f'{self.__class__.__name__}: '
f'{self.__class__.read_text_file.__name__}'
)
self.errors.raise_error_message(f"No such file or directory: '{file}'", exit_status=20)
def process(self, command: str, stderr=None, stdout=None, filename=None) -> None:
@ -159,8 +163,10 @@ class Utilities(Configs):
output = subprocess.run(f'{command}{tee}', shell=True, stderr=stderr, stdout=stdout)
except subprocess.CalledProcessError as error:
logger = logging.getLogger(LoggingConfig.date_time)
logger.exception(f'{self.__class__.__name__}'
f'{self.__class__.process.__name__}')
logger.exception(
f'{self.__class__.__name__}'
f'{self.__class__.process.__name__}'
)
self.errors.raise_error_message(str(error), exit_status=20)
except KeyboardInterrupt:
raise SystemExit(1)