From 428f37b151d249f18bc211d2dd582beb4abaced8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 5 Apr 2023 21:34:25 +0300 Subject: [PATCH] Added logging path --- slpkg/configs.py | 3 +++ slpkg/upgrade.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/slpkg/configs.py b/slpkg/configs.py index 6c2fe848..4ab8d105 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -46,6 +46,8 @@ class Configs: } prog_name: str = 'slpkg' + root_slpkg: Path = Path(Path.home(), f'.{prog_name}') + log_path: Path = Path(root_slpkg, 'logs') os_arch: str = platform.machine() tmp_path: str = '/tmp/' tmp_slpkg: Path = Path(tmp_path, prog_name) @@ -114,6 +116,7 @@ class Configs: # Creating the paths if not exists paths = [ tmp_slpkg, + log_path, build_path, download_only_path, lib_path, diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index 8ba0502f..604336f8 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -24,7 +24,7 @@ class Upgrade(Configs): self.repo_for_binaries: bool = self.utils.is_option(self.flag_bin_repository, self.flags) self.all_installed: list = self.utils.installed_package_names - logging.basicConfig(filename='slpkg_upgrade.log', encoding='utf-8', level=logging.DEBUG) + logging.basicConfig(filename=f'{self.log_path}/slpkg_upgrade.log', encoding='utf-8', level=logging.DEBUG) def packages(self) -> Generator[str, None, None]: """ Returns the upgradable packages. """