From: Frank Brehm Date: Fri, 18 Nov 2022 09:38:37 +0000 (+0100) Subject: Adjusting logging in lib/pp_admintools/app/pdns.py X-Git-Tag: 0.7.2^2^2~4 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=a412e426d5e840f24958809de7e66e06bf39168a;p=pixelpark%2Fpp-admin-tools.git Adjusting logging in lib/pp_admintools/app/pdns.py --- diff --git a/lib/pp_admintools/app/pdns.py b/lib/pp_admintools/app/pdns.py index d484c09..22f79ec 100644 --- a/lib/pp_admintools/app/pdns.py +++ b/lib/pp_admintools/app/pdns.py @@ -41,7 +41,7 @@ from ..config.pdns import PdnsConfiguration from ..xlate import XLATOR -__version__ = '0.9.7' +__version__ = '0.9.8' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -293,6 +293,32 @@ class PpPDNSApplication(BaseMailApplication): Public available method to execute some actions after parsing the command line parameters. """ + # ------------------------------------------------------------------------- + def init_logging(self): + """Initialize the logger object. + + It creates a colored loghandler with all output to STDERR. + Maybe overridden in descendant classes. + + @return: None + """ + + super(PpPDNSApplication, self).init_logging() + + if self.verbose < 3: + urllib3_logger = logging.getLogger('urllib3.connectionpool') + if self.verbose < 1: + urllib3_logger.setLevel(logging.WARNING) + else: + urllib3_logger.setLevel(logging.INFO) + + chardet_logger = logging.getLogger('chardet.charsetprober') + if self.verbose < 1: + chardet_logger.setLevel(logging.WARNING) + else: + chardet_logger.setLevel(logging.INFO) + + return # ------------------------------------------------------------------------- def _check_path_config(self, section, section_name, key, class_prop, absolute=True, desc=None):