Add oslo.config option for split-loggers
For people setting creating Sessions via load_from_conf_options, such as the OpenStack services, turning on split-loggers needs to be done in a config file. In order to do that, we need to expose it in the conf options list. Don't add it to the argparse options for now - it would just add another command line option that is less likely to see use. Change-Id: I106c6acbe306e581d293612630ec810c11d9d61c
This commit is contained in:
parent
244780fba8
commit
80323289c7
|
@ -147,6 +147,7 @@ class Session(base.BaseLoader):
|
||||||
:insecure: Whether to ignore SSL verification.
|
:insecure: Whether to ignore SSL verification.
|
||||||
:timeout: The max time to wait for HTTP connections.
|
:timeout: The max time to wait for HTTP connections.
|
||||||
:collect-timing: Whether to collect API timing information.
|
:collect-timing: Whether to collect API timing information.
|
||||||
|
:split-loggers: Whether to log requests to multiple loggers.
|
||||||
|
|
||||||
:param dict deprecated_opts: Deprecated options that should be included
|
:param dict deprecated_opts: Deprecated options that should be included
|
||||||
in the definition of new options. This should be a dict from the
|
in the definition of new options. This should be a dict from the
|
||||||
|
@ -188,6 +189,11 @@ class Session(base.BaseLoader):
|
||||||
'collect-timing'),
|
'collect-timing'),
|
||||||
default=False,
|
default=False,
|
||||||
help='Collect per-API call timing information.'),
|
help='Collect per-API call timing information.'),
|
||||||
|
cfg.BoolOpt('split-loggers',
|
||||||
|
deprecated_opts=deprecated_opts.get(
|
||||||
|
'split-loggers'),
|
||||||
|
default=False,
|
||||||
|
help='Log requests to multiple loggers.')
|
||||||
]
|
]
|
||||||
|
|
||||||
def register_conf_options(self, conf, group, deprecated_opts=None):
|
def register_conf_options(self, conf, group, deprecated_opts=None):
|
||||||
|
@ -200,6 +206,7 @@ class Session(base.BaseLoader):
|
||||||
:insecure: Whether to ignore SSL verification.
|
:insecure: Whether to ignore SSL verification.
|
||||||
:timeout: The max time to wait for HTTP connections.
|
:timeout: The max time to wait for HTTP connections.
|
||||||
:collect-timing: Whether to collect API timing information.
|
:collect-timing: Whether to collect API timing information.
|
||||||
|
:split-loggers: Whether to log requests to multiple loggers.
|
||||||
|
|
||||||
:param oslo_config.Cfg conf: config object to register with.
|
:param oslo_config.Cfg conf: config object to register with.
|
||||||
:param string group: The ini group to register options in.
|
:param string group: The ini group to register options in.
|
||||||
|
@ -242,6 +249,7 @@ class Session(base.BaseLoader):
|
||||||
kwargs.setdefault('key', c.keyfile)
|
kwargs.setdefault('key', c.keyfile)
|
||||||
kwargs.setdefault('timeout', c.timeout)
|
kwargs.setdefault('timeout', c.timeout)
|
||||||
kwargs.setdefault('collect_timing', c.collect_timing)
|
kwargs.setdefault('collect_timing', c.collect_timing)
|
||||||
|
kwargs.setdefault('split_loggers', c.split_loggers)
|
||||||
|
|
||||||
return self.load_from_options(**kwargs)
|
return self.load_from_options(**kwargs)
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ class ConfLoadingTests(utils.TestCase):
|
||||||
'insecure',
|
'insecure',
|
||||||
'timeout',
|
'timeout',
|
||||||
'collect-timing',
|
'collect-timing',
|
||||||
|
'split-loggers',
|
||||||
]
|
]
|
||||||
depr = dict([(n, [new_deprecated()]) for n in opt_names])
|
depr = dict([(n, [new_deprecated()]) for n in opt_names])
|
||||||
opts = loading.get_session_conf_options(deprecated_opts=depr)
|
opts = loading.get_session_conf_options(deprecated_opts=depr)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added ``split-loggers`` option to the oslo.config Session options.
|
Loading…
Reference in New Issue