Make empty environment variable TRYTOND_LOGGING_LEVEL be treated as unset
This commit is contained in:
@@ -9,12 +9,11 @@ from io import StringIO
|
||||
__all__ = ['app']
|
||||
|
||||
# Logging must be set before importing
|
||||
logging_config = os.environ.get('TRYTOND_LOGGING_CONFIG')
|
||||
logging_level = int(os.environ.get(
|
||||
'TRYTOND_LOGGING_LEVEL', default=logging.ERROR))
|
||||
if logging_config:
|
||||
if logging_config := os.environ.get('TRYTOND_LOGGING_CONFIG'):
|
||||
logging.config.fileConfig(logging_config)
|
||||
else:
|
||||
logging_level = int(
|
||||
os.environ.get('TRYTOND_LOGGING_LEVEL') or logging.ERROR)
|
||||
logformat = ('%(process)s %(thread)s [%(asctime)s] '
|
||||
'%(levelname)s %(name)s %(message)s')
|
||||
level = max(logging_level, logging.NOTSET)
|
||||
|
||||
@@ -188,8 +188,9 @@ def config_log(options):
|
||||
else:
|
||||
logformat = ('%(process)s %(thread)s [%(asctime)s] '
|
||||
'%(levelname)s %(name)s %(message)s')
|
||||
if not options.verbose and 'TRYTOND_LOGGING_LEVEL' in os.environ:
|
||||
logging_level = int(os.environ['TRYTOND_LOGGING_LEVEL'])
|
||||
if not options.verbose:
|
||||
logging_level = int(
|
||||
os.environ.get('TRYTOND_LOGGING_LEVEL') or logging.ERROR)
|
||||
level = max(logging_level, logging.NOTSET)
|
||||
else:
|
||||
level = max(logging.ERROR - options.verbose * 10, logging.NOTSET)
|
||||
|
||||
Reference in New Issue
Block a user