From a412e426d5e840f24958809de7e66e06bf39168a Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 18 Nov 2022 10:38:37 +0100 Subject: [PATCH] Adjusting logging in lib/pp_admintools/app/pdns.py --- lib/pp_admintools/app/pdns.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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): -- 2.39.5