Added logging

This commit is contained in:
Dimitris Zlatanidis 2023-04-05 23:48:20 +03:00
parent 795650e85a
commit 20f0aa105e

View file

@ -3,6 +3,7 @@
import os
import sys
import logging
from pathlib import Path
from slpkg.checks import Check
@ -26,6 +27,7 @@ from slpkg.binaries.install import Packages
from slpkg.check_updates import CheckUpdates
from slpkg.sbos.slackbuild import Slackbuilds
from slpkg.binaries.queries import BinQueries
from slpkg.logging_config import LoggingConfig
from slpkg.find_installed import FindInstalled
from slpkg.views.view_package import ViewPackage
from slpkg.remove_packages import RemovePackages
@ -283,6 +285,11 @@ class Argparse(Configs):
self.check = Check(self.flags)
self.check.is_blacklist(self.args[1:])
logging.basicConfig(filename=LoggingConfig.log_file,
filemode='w',
encoding='utf-8',
level=logging.INFO)
def check_for_bin_repositories(self) -> None:
""" Checks combination for binaries use repositories only and if repository exists. """
if self.utils.is_option(self.flag_binaries, self.flags):
@ -810,7 +817,9 @@ def main():
try:
arguments[args[0]]()
except (KeyError, IndexError):
except (KeyError, IndexError) as err:
logger = logging.getLogger(__name__)
logger.info('%s: %s', main.__name__, err)
usage.help_short(1)