From: Frank Brehm Date: Mon, 7 Dec 2020 17:22:04 +0000 (+0100) Subject: Fixing logging X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=c232566dfcc8dac7faa69e037eb019e1e6d89530;p=pixelpark%2Fldap-migration.git Fixing logging --- diff --git a/lib/ldap_migration/__init__.py b/lib/ldap_migration/__init__.py index 5a03095..6507871 100644 --- a/lib/ldap_migration/__init__.py +++ b/lib/ldap_migration/__init__.py @@ -45,7 +45,7 @@ from .config import LDAPMigrationConfiguration from .idict import CaseInsensitiveDict from .istringset import CaseInsensitiveStringSet -__version__ = '0.8.7' +__version__ = '0.8.8' LOG = logging.getLogger(__name__) CFG_BASENAME = 'ldap-migration.ini' @@ -368,7 +368,9 @@ class LDAPMigrationApplication(BaseApplication): """ log_level = logging.INFO - if self.quiet: + if self.verbose: + log_level = logging.DEBUG + elif self.quiet: log_level = logging.WARNING root_logger = logging.getLogger() @@ -378,7 +380,10 @@ class LDAPMigrationApplication(BaseApplication): # create log handler for console output lh_console = logging.StreamHandler(sys.stderr) - lh_console.setLevel(log_level) + if self.quiet: + lh_console.setLevel(logging.WARNING) + else: + lh_console.setLevel(logging.INFO) lh_console.setFormatter(formatter) root_logger.addHandler(lh_console) @@ -390,6 +395,7 @@ class LDAPMigrationApplication(BaseApplication): else: paramiko_logger.setLevel(logging.INFO) + # create log handler for file output lf_formatter = self._get_logfile_formatter() lh_file = logging.FileHandler( str(self.general_logfile), mode='a', encoding='utf-8', delay=True)