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:
Monty Taylor 2018-05-16 10:13:44 -05:00
parent 244780fba8
commit 80323289c7
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
3 changed files with 13 additions and 0 deletions

View File

@ -147,6 +147,7 @@ class Session(base.BaseLoader):
:insecure: Whether to ignore SSL verification.
:timeout: The max time to wait for HTTP connections.
: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
in the definition of new options. This should be a dict from the
@ -188,6 +189,11 @@ class Session(base.BaseLoader):
'collect-timing'),
default=False,
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):
@ -200,6 +206,7 @@ class Session(base.BaseLoader):
:insecure: Whether to ignore SSL verification.
:timeout: The max time to wait for HTTP connections.
: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 string group: The ini group to register options in.
@ -242,6 +249,7 @@ class Session(base.BaseLoader):
kwargs.setdefault('key', c.keyfile)
kwargs.setdefault('timeout', c.timeout)
kwargs.setdefault('collect_timing', c.collect_timing)
kwargs.setdefault('split_loggers', c.split_loggers)
return self.load_from_options(**kwargs)

View File

@ -77,6 +77,7 @@ class ConfLoadingTests(utils.TestCase):
'insecure',
'timeout',
'collect-timing',
'split-loggers',
]
depr = dict([(n, [new_deprecated()]) for n in opt_names])
opts = loading.get_session_conf_options(deprecated_opts=depr)

View File

@ -0,0 +1,4 @@
---
features:
- |
Added ``split-loggers`` option to the oslo.config Session options.