Set a min and max on the connection_debug option
There is a set allowable minimum and maximum to the connection_debug option of 0 and 100. The config option should enforce this. Change-Id: Ica610ad8fc0875a8be1042f7daba5d0a0c1aad03
This commit is contained in:
committed by
Roman Podoliaka
parent
58d60ca5b2
commit
e0cc306c0a
@@ -101,6 +101,7 @@ database_opts = [
|
|||||||
'SQLAlchemy.'),
|
'SQLAlchemy.'),
|
||||||
cfg.IntOpt('connection_debug',
|
cfg.IntOpt('connection_debug',
|
||||||
default=0,
|
default=0,
|
||||||
|
min=0, max=100,
|
||||||
deprecated_opts=[cfg.DeprecatedOpt('sql_connection_debug',
|
deprecated_opts=[cfg.DeprecatedOpt('sql_connection_debug',
|
||||||
group='DEFAULT')],
|
group='DEFAULT')],
|
||||||
help='Verbosity of SQL debugging information: 0=None, '
|
help='Verbosity of SQL debugging information: 0=None, '
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ def _setup_logging(connection_debug=0):
|
|||||||
"""
|
"""
|
||||||
if connection_debug >= 0:
|
if connection_debug >= 0:
|
||||||
logger = logging.getLogger('sqlalchemy.engine')
|
logger = logging.getLogger('sqlalchemy.engine')
|
||||||
if connection_debug >= 100:
|
if connection_debug == 100:
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
elif connection_debug >= 50:
|
elif connection_debug >= 50:
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- The allowed values for the ``connection_debug`` option are now restricted to
|
||||||
|
the range between 0 and 100 (inclusive). Previously a number lower than 0
|
||||||
|
or higher than 100 could be given without error. But now, a
|
||||||
|
``ConfigFileValueError`` will be raised when the option value is outside this
|
||||||
|
range.
|
||||||
Reference in New Issue
Block a user