From fe299ba21edd0999080b6772d3d1b3053e0baf6f Mon Sep 17 00:00:00 2001 From: René Stadler Date: Sat, 29 Nov 2008 21:06:52 +0200 Subject: 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. --- GstDebugViewer/Common/Main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'GstDebugViewer') diff --git a/GstDebugViewer/Common/Main.py b/GstDebugViewer/Common/Main.py index e066331..63071ec 100644 --- a/GstDebugViewer/Common/Main.py +++ b/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', -- cgit v1.2.3