Refactor setup_logging

This change just cleans up the setup_logging function. It was
defined in keystone.common.config and then also exported from
keystone.config. Also, it had extra parameters that were unused.

This takes care of a NOTE (which probably should have been a
TODO) in the code.

Change-Id: I1a46c8974cbd68a5bf708d253adfadc1fdb76dcd
This commit is contained in:
Brant Knudson 2013-12-13 13:05:28 -06:00
parent f6aa72334c
commit 9b07e20dee
5 changed files with 9 additions and 19 deletions

View File

@ -104,7 +104,7 @@ if __name__ == '__main__':
version=pbr.version.VersionInfo('keystone').version_string(),
default_config_files=config_files)
config.setup_logging(CONF, product_name='keystone')
config.setup_logging()
# Log the options used when starting if we're in debug mode...
if CONF.debug:

View File

@ -33,7 +33,7 @@ from keystone.openstack.common import log
CONF = config.CONF
CONF(project='keystone')
config.setup_logging(CONF)
config.setup_logging()
environment.use_stdlib()
name = os.path.basename(__file__)

View File

@ -215,5 +215,5 @@ def main(argv=None, config_files=None):
version=pbr.version.VersionInfo('keystone').version_string(),
usage='%(prog)s [' + '|'.join([cmd.name for cmd in CMDS]) + ']',
default_config_files=config_files)
config.setup_logging(CONF)
config.setup_logging()
CONF.command.cmd_class.main()

View File

@ -16,8 +16,6 @@
from oslo.config import cfg
from keystone.openstack.common import log as logging
_DEFAULT_LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s"
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
@ -277,19 +275,6 @@ FILE_OPTIONS = {
CONF = cfg.CONF
def setup_logging(conf, product_name='keystone'):
"""Sets up the logging options for a log with supplied name
:param conf: a cfg.ConfOpts object
"""
# NOTE(ldbragst): This method will be removed along with other
# refactoring in favor of using the
# keystone/openstack/common/log.py implementation. This just ensures
# that in the time between introduction and refactoring, we still have
# a working logging implementation.
logging.setup(product_name)
def setup_authentication(conf=None):
# register any non-default auth methods here (used by extensions, etc)
if conf is None:

View File

@ -19,16 +19,21 @@ import os
from keystone.common import config
from keystone import exception
from keystone.openstack.common import log
config.configure()
CONF = config.CONF
setup_logging = config.setup_logging
setup_authentication = config.setup_authentication
configure = config.configure
def setup_logging():
"""Sets up logging for the keystone package."""
log.setup('keystone')
def find_paste_config():
"""Find Keystone's paste.deploy configuration file.