From b468acd8362e6077f43d1dc32ab315d7f8344eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Sat, 29 Nov 2008 21:06:52 +0200 Subject: [PATCH] Fix logging being on by default with recent Python The fix for Python issue #1021 uncovered a mistake of mine. I was under the impression that logging.NOTSET level means "off", but in fact it means to not modify the level, and setting that on the root logger with basicConfig leads to turning on all levels. --- debug-viewer/GstDebugViewer/Common/Main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debug-viewer/GstDebugViewer/Common/Main.py b/debug-viewer/GstDebugViewer/Common/Main.py index e0663319d8..63071ecd1e 100644 --- a/debug-viewer/GstDebugViewer/Common/Main.py +++ b/debug-viewer/GstDebugViewer/Common/Main.py @@ -400,15 +400,15 @@ class LogOptionParser (OptionParser): try: level = int (arg) except ValueError: - level = {"off" : logging.NOTSET, - "none" : logging.NOTSET, + level = {"off" : None, + "none" : None, "debug" : logging.DEBUG, "info" : logging.INFO, "warning" : logging.WARNING, "error" : logging.ERROR, "critical" : logging.CRITICAL}.get (arg.strip ().lower ()) if level is None: - return logging.NOTSET + return None else: return level else: @@ -416,7 +416,7 @@ class LogOptionParser (OptionParser): level = 0 elif level > 5: level = 5 - return {0 : logging.NOTSET, + return {0 : None, 1 : logging.DEBUG, 2 : logging.INFO, 3 : logging.WARNING, @@ -461,7 +461,7 @@ def _init_options (option_parser = None): return option_parser.options -def _init_logging (level = logging.NOTSET): +def _init_logging (level = None): logging.basicConfig (level = level, format = '%(asctime)s.%(msecs)03d %(levelname)8s %(name)20s: %(message)s',