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: I5015714caaed5b031a2ebdbaec4cb934cd29b455
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2018-10-16 14:19:13 -05:00
parent f54dc0fbd1
commit 8883c5cd1c
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
2 changed files with 12 additions and 8 deletions

View File

@ -18,6 +18,9 @@ import re
from docutils import nodes
from docutils.parsers.rst.directives.tables import Table
from docutils.parsers.rst import directives
from sphinx.util import logging
LOG = logging.getLogger(__name__)
# Full name (IRC nickname) [expires in] {role}
_PATTERN = re.compile('(?P<name>.*)\s+\((?P<irc>.*)\)\s+\[(?P<date>.*)\](\s+\{(?P<role>.*)\})?')
@ -33,7 +36,7 @@ def _parse_members_file(app, filename):
continue
m = _PATTERN.match(line)
if not m:
app.warning('Could not parse line %d of %s: %r' %
LOG.warning('Could not parse line %d of %s: %r' %
(linum, filename, line))
continue
yield m.groupdict()
@ -150,5 +153,5 @@ class MembersTable(Table):
return table
def setup(app):
app.info('loading members extension')
LOG.info('loading members extension')
app.add_directive('memberstable', MembersTable)

View File

@ -12,14 +12,16 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Build a table of the current teams
"""
"""Build a table of the current teams"""
import yaml
from docutils import nodes
from docutils.parsers.rst.directives.tables import Table
from docutils.parsers.rst import directives
from sphinx.util import logging
import yaml
LOG = logging.getLogger(__name__)
class TeamTable(Table):
@ -34,7 +36,6 @@ class TeamTable(Table):
}
def run(self):
env = self.state.document.settings.env
app = env.app
if self.options.get('headers') is not None:
self.HEADERS = self.options.get('headers').split(",")
@ -68,8 +69,8 @@ class TeamTable(Table):
# Now find the real path to the file, relative to where we are.
rel_filename, filename = env.relfn2path(datafile)
app.info('loading teamtable')
app.info('reading %s' % filename)
LOG.info('loading teamtable')
LOG.info('reading %s' % filename)
with open(filename, 'r') as f:
_teams_yaml = yaml.load(f.read())