48
48
49
49
from docutils import nodes
50
50
from sphinx .builders import Builder
51
+ import sphinx .util
51
52
52
53
detect_all = re .compile (r'''
53
54
::(?=[^=])| # two :: (but NOT ::=)
@@ -85,6 +86,7 @@ class CheckSuspiciousMarkupBuilder(Builder):
85
86
Checks for possibly invalid markup that may leak into the output.
86
87
"""
87
88
name = 'suspicious'
89
+ logger = sphinx .util .logging .getLogger ("CheckSuspiciousMarkupBuilder" )
88
90
89
91
def init (self ):
90
92
# create output file
@@ -116,7 +118,7 @@ def finish(self):
116
118
self .warn ('Found %s/%s unused rules:' %
117
119
(len (unused_rules ), len (self .rules )))
118
120
for rule in unused_rules :
119
- self .info (repr (rule ))
121
+ self .logger . info (repr (rule ))
120
122
return
121
123
122
124
def check_issue (self , line , lineno , issue ):
@@ -146,7 +148,7 @@ def is_ignored(self, line, lineno, issue):
146
148
return False
147
149
148
150
def report_issue (self , text , lineno , issue ):
149
- if not self .any_issue : self .info ()
151
+ if not self .any_issue : self .logger . info ()
150
152
self .any_issue = True
151
153
self .write_log_entry (lineno , issue , text )
152
154
if py3 :
@@ -181,7 +183,7 @@ def load_rules(self, filename):
181
183
A csv file, with exactly the same format as suspicious.csv
182
184
Fields: document name (normalized), line number, issue, surrounding text
183
185
"""
184
- self .info ("loading ignore rules... " , nonl = 1 )
186
+ self .logger . info ("loading ignore rules... " , nonl = 1 )
185
187
self .rules = rules = []
186
188
try :
187
189
if py3 :
@@ -206,7 +208,7 @@ def load_rules(self, filename):
206
208
rule = Rule (docname , lineno , issue , text )
207
209
rules .append (rule )
208
210
f .close ()
209
- self .info ('done, %d rules loaded' % len (self .rules ))
211
+ self .logger . info ('done, %d rules loaded' % len (self .rules ))
210
212
211
213
212
214
def get_lineno (node ):
0 commit comments