]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Adjusting logging in lib/pp_admintools/app/pdns.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 18 Nov 2022 09:38:37 +0000 (10:38 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 18 Nov 2022 09:38:37 +0000 (10:38 +0100)
lib/pp_admintools/app/pdns.py

index d484c0927405316d08d9eb7a9513fceb37b7bda4..22f79ecdcaf8ebea39967e67570c828819672527 100644 (file)
@@ -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):