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: I3abce4e3c147befd0235820cb8850fe18f6dee42
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2018-10-16 14:21:33 -05:00
parent e878df1a16
commit 87ca0d72fa
1 changed files with 5 additions and 7 deletions

View File

@ -16,10 +16,12 @@ from docutils import nodes
from docutils.parsers import rst from docutils.parsers import rst
from docutils.parsers.rst import directives from docutils.parsers.rst import directives
from docutils.statemachine import ViewList from docutils.statemachine import ViewList
from sphinx.util import logging
from sphinx.util.nodes import nested_parse_with_titles from sphinx.util.nodes import nested_parse_with_titles
from stevedore import extension from stevedore import extension
LOG = logging.getLogger(__name__)
class ListAuthPluginsDirective(rst.Directive): class ListAuthPluginsDirective(rst.Directive):
"""Present a simple list of the plugins in a namespace.""" """Present a simple list of the plugins in a namespace."""
@ -32,12 +34,8 @@ class ListAuthPluginsDirective(rst.Directive):
has_content = True has_content = True
@property
def app(self):
return self.state.document.settings.env.app
def report_load_failure(mgr, ep, err): def report_load_failure(mgr, ep, err):
self.app.warn(u'Failed to load %s: %s' % (ep.module_name, err)) LOG.warning(u'Failed to load %s: %s' % (ep.module_name, err))
def display_plugin(self, ext): def display_plugin(self, ext):
overline_style = self.options.get('overline-style', '') overline_style = self.options.get('overline-style', '')
@ -89,5 +87,5 @@ class ListAuthPluginsDirective(rst.Directive):
def setup(app): def setup(app):
app.info('loading keystoneauth1 plugins') LOG.info('loading keystoneauth1 plugins')
app.add_directive('list-auth-plugins', ListAuthPluginsDirective) app.add_directive('list-auth-plugins', ListAuthPluginsDirective)