Update sphinx extension logging

Sphinx 1.6 deprecated using the application object to perform logging
and it will be removed in the upcoming 2.0 release. This updates our
extensions to use the recommended sphinx.util.logging instead.

Change-Id: Ia9edbfd551d260b798818940e4d156957f382324
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2018-10-16 14:35:47 -05:00
parent 25b4e3daba
commit 0bd7e90d32

View File

@ -17,14 +17,18 @@
import os import os
from sphinx.util import logging
from oslo_policy import generator from oslo_policy import generator
LOG = logging.getLogger(__name__)
def generate_sample(app): def generate_sample(app):
"""Generate a sample policy file.""" """Generate a sample policy file."""
if not app.config.policy_generator_config_file: if not app.config.policy_generator_config_file:
app.warn("No policy_generator_config_file is specified, " LOG.warning("No policy_generator_config_file is specified, "
"skipping sample policy generation") "skipping sample policy generation")
return return
@ -46,7 +50,7 @@ def _get_default_basename(config_file):
def _generate_sample(app, policy_file, base_name): def _generate_sample(app, policy_file, base_name):
def info(msg): def info(msg):
app.info('[%s] %s' % (__name__, msg)) LOG.info('[%s] %s' % (__name__, msg))
# If we are given a file that isn't an absolute path, look for it # If we are given a file that isn't an absolute path, look for it
# in the source directory if it doesn't exist. # in the source directory if it doesn't exist.