Updated logging

This commit is contained in:
Dimitris Zlatanidis 2023-04-05 21:38:25 +03:00
parent 428f37b151
commit bd69f9be4e

View file

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import logging
from pathlib import Path
from typing import Generator
from packaging.version import parse, InvalidVersion
@ -24,7 +25,11 @@ 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=f'{self.log_path}/slpkg_upgrade.log', encoding='utf-8', level=logging.DEBUG)
log_file: Path = Path(self.log_path, 'debug_upgrade.log')
logging.basicConfig(filename=log_file,
encoding='utf-8',
level=logging.DEBUG)
def packages(self) -> Generator[str, None, None]:
""" Returns the upgradable packages. """
@ -67,6 +72,6 @@ class Upgrade(Configs):
if parse(repo_version) == parse(inst_version) and parse(repo_build) > parse(inst_build):
return True
except InvalidVersion as err:
logging.debug(err)
logging.error(err)
return False