]> git.ipfire.org Git - location/libloc.git/commitdiff
python: Correctly set log level for root logger
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 May 2020 10:58:25 +0000 (10:58 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 May 2020 10:58:25 +0000 (10:58 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location-downloader.in
src/python/location-exporter.in
src/python/location-importer.in
src/python/location-query.in
src/python/logger.py

index 2d38136f9a577789676fb3b57b30b762aa956b25..f1d38f1418a87c803d78ee18beea13932aef5fae 100644 (file)
@@ -247,7 +247,7 @@ class CLI(object):
 
                # Enable debug logging
                if args.debug:
-                       log.setLevel(logging.DEBUG)
+                       location.logger.set_level(logging.DEBUG)
 
                # Print usage if no action was given
                if not "func" in args:
index 3e53d4183c5f8e970972fb521e073db589e9e921..634b8625ba82feee8d3088bf0f82c07dc250912f 100644 (file)
@@ -224,7 +224,7 @@ class CLI(object):
 
                # Enable debug logging
                if args.debug:
-                       log.setLevel(logging.DEBUG)
+                       location.logger.set_level(logging.DEBUG)
 
                return args
 
index fe7c0b1b9f612b18299012c44cc42c8071e8c9c4..45cacad81c58db8b0aeed25cac7333092c54049e 100644 (file)
@@ -93,7 +93,7 @@ class CLI(object):
 
                # Enable debug logging
                if args.debug:
-                       log.setLevel(logging.DEBUG)
+                       location.logger.set_level(logging.DEBUG)
 
                # Print usage if no action was given
                if not "func" in args:
index fb695b0821233138f569a970eb6b4407a0d22063..85d1cbf82ac41414d3d624cc0fd209f816df0ff8 100644 (file)
@@ -204,6 +204,10 @@ class CLI(object):
 
                args = parser.parse_args()
 
+               # Enable debug logging
+               if args.debug:
+                       location.logger.set_level(logging.DEBUG)
+
                # Print usage if no action was given
                if not "func" in args:
                        parser.print_usage()
index 18d8123a2850d9308ba745fb736fa8f38f6c76f2..0bdf9ec45d0f7ca7b86d7a1e0b44b29f7666f516 100644 (file)
@@ -22,7 +22,7 @@ import logging.handlers
 
 # Initialise root logger
 log = logging.getLogger("location")
-log.setLevel(logging.DEBUG)
+log.setLevel(logging.INFO)
 
 # Log to console
 handler = logging.StreamHandler()
@@ -38,3 +38,9 @@ log.addHandler(handler)
 # Format syslog messages
 formatter = logging.Formatter("%(message)s")
 handler.setFormatter(formatter)
+
+def set_level(level):
+       """
+               Sets the log level for the root logger
+       """
+       log.setLevel(level)