Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Stop using deprecated logging API in Sphinx #9875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Doc/tools/extensions/suspicious.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

from docutils import nodes
from sphinx.builders import Builder
import sphinx.util

detect_all = re.compile(r'''
::(?=[^=])| # two :: (but NOT ::=)
Expand Down Expand Up @@ -85,6 +86,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
Checks for possibly invalid markup that may leak into the output.
"""
name = 'suspicious'
logger = sphinx.util.logging.getLogger("CheckSuspiciousMarkupBuilder")

def init(self):
# create output file
Expand Down Expand Up @@ -116,7 +118,7 @@ def finish(self):
self.warn('Found %s/%s unused rules:' %
(len(unused_rules), len(self.rules)))
for rule in unused_rules:
self.info(repr(rule))
self.logger.info(repr(rule))
return

def check_issue(self, line, lineno, issue):
Expand Down Expand Up @@ -146,7 +148,7 @@ def is_ignored(self, line, lineno, issue):
return False

def report_issue(self, text, lineno, issue):
if not self.any_issue: self.info()
if not self.any_issue: self.logger.info()
self.any_issue = True
self.write_log_entry(lineno, issue, text)
if py3:
Expand Down Expand Up @@ -181,7 +183,7 @@ def load_rules(self, filename):
A csv file, with exactly the same format as suspicious.csv
Fields: document name (normalized), line number, issue, surrounding text
"""
self.info("loading ignore rules... ", nonl=1)
self.logger.info("loading ignore rules... ", nonl=1)
self.rules = rules = []
try:
if py3:
Expand All @@ -206,7 +208,7 @@ def load_rules(self, filename):
rule = Rule(docname, lineno, issue, text)
rules.append(rule)
f.close()
self.info('done, %d rules loaded' % len(self.rules))
self.logger.info('done, %d rules loaded' % len(self.rules))


def get_lineno(node):
Expand Down