[gtk-doc] common: fix the logging setup



commit 7d7a3d77a0be36acbe7b8a3a9f87565cca4b854d
Author: Stefan Sauer <ensonic users sf net>
Date:   Fri Mar 2 07:58:23 2018 +0100

    common: fix the logging setup
    
    Pass the default log_level to os_environ.get() to avoid having to add a
    check for None. This way we alway configure the logger.

 gtkdoc/common.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gtkdoc/common.py b/gtkdoc/common.py
index 5871465..f62e6de 100644
--- a/gtkdoc/common.py
+++ b/gtkdoc/common.py
@@ -63,13 +63,12 @@ def setup_logging():
     Set python log level to the value of the environment variable (DEBUG, INFO,
     WARNING, ERROR and CRITICAL) or INFO if the environment variable is empty.
     """
-    log_level = os.environ.get('GTKDOC_TRACE')
+    log_level = os.environ.get('GTKDOC_TRACE', 'WARNING')
     if log_level == '':
-        log_level = 'INFO'
-    if log_level:
-        logging.basicConfig(stream=sys.stdout,
-                            level=logging.getLevelName(log_level.upper()),
-                            
format='%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(levelname)s:%(message)s')
+        log_level = 'WARNING'
+    logging.basicConfig(stream=sys.stdout,
+                        level=logging.getLevelName(log_level.upper()),
+                        format='%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(levelname)s:%(message)s')
     # When redirecting the output on python2 or if run with a non utf-8 locale
     # we get UnicodeEncodeError:
     encoding = sys.stdout.encoding


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]