mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
autodoc: use debug2() and [autodoc] prefix
This commit is contained in:
parent
72132ffebd
commit
7d2715ab17
@ -317,27 +317,28 @@ class Documenter(object):
|
|||||||
|
|
||||||
Returns True if successful, False if an error occurred.
|
Returns True if successful, False if an error occurred.
|
||||||
"""
|
"""
|
||||||
|
dbg = self.env.app.debug
|
||||||
if self.objpath:
|
if self.objpath:
|
||||||
self.env.app.debug('autodoc: from %s import %s',
|
dbg('[autodoc] from %s import %s',
|
||||||
self.modname, '.'.join(self.objpath))
|
self.modname, '.'.join(self.objpath))
|
||||||
try:
|
try:
|
||||||
self.env.app.debug('autodoc: import %s', self.modname)
|
dbg('[autodoc] import %s', self.modname)
|
||||||
__import__(self.modname)
|
__import__(self.modname)
|
||||||
parent = None
|
parent = None
|
||||||
obj = self.module = sys.modules[self.modname]
|
obj = self.module = sys.modules[self.modname]
|
||||||
self.env.app.debug('autodoc: => %r', obj)
|
dbg('[autodoc] => %r', obj)
|
||||||
for part in self.objpath:
|
for part in self.objpath:
|
||||||
parent = obj
|
parent = obj
|
||||||
self.env.app.debug('autodoc: getattr(_, %r)', part)
|
dbg('[autodoc] getattr(_, %r)', part)
|
||||||
obj = self.get_attr(obj, part)
|
obj = self.get_attr(obj, part)
|
||||||
self.env.app.debug('autodoc: => %r', obj)
|
dbg('[autodoc] => %r', obj)
|
||||||
self.object_name = part
|
self.object_name = part
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.object = obj
|
self.object = obj
|
||||||
return True
|
return True
|
||||||
# this used to only catch SyntaxError, ImportError and AttributeError,
|
# this used to only catch SyntaxError, ImportError and AttributeError,
|
||||||
# but importing modules with side effects can raise all kinds of errors
|
# but importing modules with side effects can raise all kinds of errors
|
||||||
except Exception, err:
|
except Exception:
|
||||||
if self.objpath:
|
if self.objpath:
|
||||||
errmsg = 'autodoc: failed to import %s %r from module %r' % \
|
errmsg = 'autodoc: failed to import %s %r from module %r' % \
|
||||||
(self.objtype, '.'.join(self.objpath), self.modname)
|
(self.objtype, '.'.join(self.objpath), self.modname)
|
||||||
@ -346,7 +347,7 @@ class Documenter(object):
|
|||||||
(self.objtype, self.fullname)
|
(self.objtype, self.fullname)
|
||||||
errmsg += '; the following exception was raised:\n%s' % \
|
errmsg += '; the following exception was raised:\n%s' % \
|
||||||
traceback.format_exc()
|
traceback.format_exc()
|
||||||
self.env.app.debug(errmsg)
|
dbg(errmsg)
|
||||||
self.directive.warn(errmsg)
|
self.directive.warn(errmsg)
|
||||||
self.env.note_reread()
|
self.env.note_reread()
|
||||||
return False
|
return False
|
||||||
@ -1309,7 +1310,7 @@ class AutoDirective(Directive):
|
|||||||
source, lineno = self.reporter.get_source_and_line(self.lineno)
|
source, lineno = self.reporter.get_source_and_line(self.lineno)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
source = lineno = None
|
source = lineno = None
|
||||||
self.env.app.debug('%s:%s: <input>\n%s',
|
self.env.app.debug('[autodoc] %s:%s: input:\n%s',
|
||||||
source, lineno, self.block_text)
|
source, lineno, self.block_text)
|
||||||
|
|
||||||
# find out what documenter to call
|
# find out what documenter to call
|
||||||
@ -1332,8 +1333,7 @@ class AutoDirective(Directive):
|
|||||||
if not self.result:
|
if not self.result:
|
||||||
return self.warnings
|
return self.warnings
|
||||||
|
|
||||||
if self.env.app.verbosity >= 2:
|
self.env.app.debug2('[autodoc] output:\n%s', '\n'.join(self.result))
|
||||||
self.env.app.debug('autodoc: <output>\n%s', '\n'.join(self.result))
|
|
||||||
|
|
||||||
# record all filenames as dependencies -- this will at least
|
# record all filenames as dependencies -- this will at least
|
||||||
# partially make automatic invalidation possible
|
# partially make automatic invalidation possible
|
||||||
|
Loading…
Reference in New Issue
Block a user