mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
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.
This commit is contained in:
parent
7dcd3db661
commit
b468acd836
1 changed files with 5 additions and 5 deletions
|
@ -400,15 +400,15 @@ class LogOptionParser (OptionParser):
|
||||||
try:
|
try:
|
||||||
level = int (arg)
|
level = int (arg)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
level = {"off" : logging.NOTSET,
|
level = {"off" : None,
|
||||||
"none" : logging.NOTSET,
|
"none" : None,
|
||||||
"debug" : logging.DEBUG,
|
"debug" : logging.DEBUG,
|
||||||
"info" : logging.INFO,
|
"info" : logging.INFO,
|
||||||
"warning" : logging.WARNING,
|
"warning" : logging.WARNING,
|
||||||
"error" : logging.ERROR,
|
"error" : logging.ERROR,
|
||||||
"critical" : logging.CRITICAL}.get (arg.strip ().lower ())
|
"critical" : logging.CRITICAL}.get (arg.strip ().lower ())
|
||||||
if level is None:
|
if level is None:
|
||||||
return logging.NOTSET
|
return None
|
||||||
else:
|
else:
|
||||||
return level
|
return level
|
||||||
else:
|
else:
|
||||||
|
@ -416,7 +416,7 @@ class LogOptionParser (OptionParser):
|
||||||
level = 0
|
level = 0
|
||||||
elif level > 5:
|
elif level > 5:
|
||||||
level = 5
|
level = 5
|
||||||
return {0 : logging.NOTSET,
|
return {0 : None,
|
||||||
1 : logging.DEBUG,
|
1 : logging.DEBUG,
|
||||||
2 : logging.INFO,
|
2 : logging.INFO,
|
||||||
3 : logging.WARNING,
|
3 : logging.WARNING,
|
||||||
|
@ -461,7 +461,7 @@ def _init_options (option_parser = None):
|
||||||
|
|
||||||
return option_parser.options
|
return option_parser.options
|
||||||
|
|
||||||
def _init_logging (level = logging.NOTSET):
|
def _init_logging (level = None):
|
||||||
|
|
||||||
logging.basicConfig (level = level,
|
logging.basicConfig (level = level,
|
||||||
format = '%(asctime)s.%(msecs)03d %(levelname)8s %(name)20s: %(message)s',
|
format = '%(asctime)s.%(msecs)03d %(levelname)8s %(name)20s: %(message)s',
|
||||||
|
|
Loading…
Reference in a new issue