summaryrefslogtreecommitdiff
path: root/sphinx/util/docutils.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-11-14 22:33:56 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-12-12 18:24:52 +0900
commit16c244cd6af79afa85202af1a0f1e325c175994f (patch)
treeea931dcad5d64d6ca0a10efa272f5733586a72b8 /sphinx/util/docutils.py
parent0e86ff2f1133e529d148cea6cc235218d73cc7d4 (diff)
downloadsphinx-git-16c244cd6af79afa85202af1a0f1e325c175994f.tar.gz
Add LoggingReporter.from_reporter() constructor
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r--sphinx/util/docutils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py
index 92e6c8c22..d24a8f827 100644
--- a/sphinx/util/docutils.py
+++ b/sphinx/util/docutils.py
@@ -167,6 +167,13 @@ class WarningStream(object):
class LoggingReporter(Reporter):
+ @classmethod
+ def from_reporter(cls, reporter):
+ # type: (Reporter) -> LoggingReporter
+ """Create an instance of LoggingReporter from other reporter object."""
+ return cls(reporter.source, reporter.report_level, reporter.halt_level,
+ reporter.debug_flag, reporter.error_handler)
+
def __init__(self, source, report_level, halt_level,
debug=False, error_handler='backslashreplace'):
# type: (unicode, int, int, bool, unicode) -> None