mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Drop debug2() (refs: #3304)
This commit is contained in:
parent
13df6f20ea
commit
ae24524d5f
@ -425,9 +425,9 @@ class Sphinx(object):
|
|||||||
def debug2(self, message, *args, **kwargs):
|
def debug2(self, message, *args, **kwargs):
|
||||||
# type: (unicode, Any, Any) -> None
|
# type: (unicode, Any, Any) -> None
|
||||||
"""Emit a lowlevel debug-level informational message."""
|
"""Emit a lowlevel debug-level informational message."""
|
||||||
warnings.warn('app.debug2() is now deprecated. Use sphinx.util.logging instead.',
|
warnings.warn('app.debug2() is now deprecated. Use debug() instead.',
|
||||||
RemovedInSphinx20Warning)
|
RemovedInSphinx20Warning)
|
||||||
logger.debug2(message, *args, **kwargs)
|
logger.debug(message, *args, **kwargs)
|
||||||
|
|
||||||
def _display_chunk(chunk):
|
def _display_chunk(chunk):
|
||||||
# type: (Any) -> unicode
|
# type: (Any) -> unicode
|
||||||
|
@ -1762,7 +1762,7 @@ class AutoDirective(Directive):
|
|||||||
if not self.result:
|
if not self.result:
|
||||||
return self.warnings
|
return self.warnings
|
||||||
|
|
||||||
logger.debug2('[autodoc] output:\n%s', '\n'.join(self.result))
|
logger.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
|
||||||
|
@ -30,7 +30,6 @@ if False:
|
|||||||
|
|
||||||
|
|
||||||
VERBOSE = 15
|
VERBOSE = 15
|
||||||
DEBUG2 = 5
|
|
||||||
|
|
||||||
LEVEL_NAMES = defaultdict(lambda: logging.WARNING) # type: Dict[str, int]
|
LEVEL_NAMES = defaultdict(lambda: logging.WARNING) # type: Dict[str, int]
|
||||||
LEVEL_NAMES.update({
|
LEVEL_NAMES.update({
|
||||||
@ -41,7 +40,6 @@ LEVEL_NAMES.update({
|
|||||||
'INFO': logging.INFO,
|
'INFO': logging.INFO,
|
||||||
'VERBOSE': VERBOSE,
|
'VERBOSE': VERBOSE,
|
||||||
'DEBUG': logging.DEBUG,
|
'DEBUG': logging.DEBUG,
|
||||||
'DEBUG2': DEBUG2,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
VERBOSITY_MAP = defaultdict(lambda: 0) # type: Dict[int, int]
|
VERBOSITY_MAP = defaultdict(lambda: 0) # type: Dict[int, int]
|
||||||
@ -49,14 +47,12 @@ VERBOSITY_MAP.update({
|
|||||||
0: logging.INFO,
|
0: logging.INFO,
|
||||||
1: VERBOSE,
|
1: VERBOSE,
|
||||||
2: logging.DEBUG,
|
2: logging.DEBUG,
|
||||||
3: DEBUG2,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
COLOR_MAP = defaultdict(lambda text: text) # type: Dict[int, unicode]
|
COLOR_MAP = defaultdict(lambda text: text) # type: Dict[int, unicode]
|
||||||
COLOR_MAP.update({
|
COLOR_MAP.update({
|
||||||
logging.WARNING: 'darkred',
|
logging.WARNING: 'darkred',
|
||||||
logging.DEBUG: 'darkgray',
|
logging.DEBUG: 'darkgray',
|
||||||
DEBUG2: 'lightgray',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -105,10 +101,6 @@ class SphinxLoggerAdapter(logging.LoggerAdapter):
|
|||||||
# type: (unicode, Any, Any) -> None
|
# type: (unicode, Any, Any) -> None
|
||||||
self.log(VERBOSE, msg, *args, **kwargs)
|
self.log(VERBOSE, msg, *args, **kwargs)
|
||||||
|
|
||||||
def debug2(self, msg, *args, **kwargs):
|
|
||||||
# type: (unicode, Any, Any) -> None
|
|
||||||
self.log(DEBUG2, msg, *args, **kwargs)
|
|
||||||
|
|
||||||
def process(self, msg, kwargs): # type: ignore
|
def process(self, msg, kwargs): # type: ignore
|
||||||
# type: (unicode, Dict) -> Tuple[unicode, Dict]
|
# type: (unicode, Dict) -> Tuple[unicode, Dict]
|
||||||
extra = kwargs.setdefault('extra', {})
|
extra = kwargs.setdefault('extra', {})
|
||||||
|
@ -24,7 +24,7 @@ from util import strip_escseq
|
|||||||
|
|
||||||
|
|
||||||
def test_info_and_warning(app, status, warning):
|
def test_info_and_warning(app, status, warning):
|
||||||
app.verbosity = 3
|
app.verbosity = 2
|
||||||
logging.setup(app, status, warning)
|
logging.setup(app, status, warning)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -56,7 +56,6 @@ def test_verbosity_filter(app, status, warning):
|
|||||||
logger.info('message1')
|
logger.info('message1')
|
||||||
logger.verbose('message2')
|
logger.verbose('message2')
|
||||||
logger.debug('message3')
|
logger.debug('message3')
|
||||||
logger.debug2('message4')
|
|
||||||
|
|
||||||
assert 'message1' in status.getvalue()
|
assert 'message1' in status.getvalue()
|
||||||
assert 'message2' not in status.getvalue()
|
assert 'message2' not in status.getvalue()
|
||||||
@ -71,7 +70,6 @@ def test_verbosity_filter(app, status, warning):
|
|||||||
logger.info('message1')
|
logger.info('message1')
|
||||||
logger.verbose('message2')
|
logger.verbose('message2')
|
||||||
logger.debug('message3')
|
logger.debug('message3')
|
||||||
logger.debug2('message4')
|
|
||||||
|
|
||||||
assert 'message1' in status.getvalue()
|
assert 'message1' in status.getvalue()
|
||||||
assert 'message2' in status.getvalue()
|
assert 'message2' in status.getvalue()
|
||||||
@ -86,28 +84,12 @@ def test_verbosity_filter(app, status, warning):
|
|||||||
logger.info('message1')
|
logger.info('message1')
|
||||||
logger.verbose('message2')
|
logger.verbose('message2')
|
||||||
logger.debug('message3')
|
logger.debug('message3')
|
||||||
logger.debug2('message4')
|
|
||||||
|
|
||||||
assert 'message1' in status.getvalue()
|
assert 'message1' in status.getvalue()
|
||||||
assert 'message2' in status.getvalue()
|
assert 'message2' in status.getvalue()
|
||||||
assert 'message3' in status.getvalue()
|
assert 'message3' in status.getvalue()
|
||||||
assert 'message4' not in status.getvalue()
|
assert 'message4' not in status.getvalue()
|
||||||
|
|
||||||
# verbosity = 3: DEBUG2
|
|
||||||
app.verbosity = 3
|
|
||||||
logging.setup(app, status, warning)
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
logger.info('message1')
|
|
||||||
logger.verbose('message2')
|
|
||||||
logger.debug('message3')
|
|
||||||
logger.debug2('message4')
|
|
||||||
|
|
||||||
assert 'message1' in status.getvalue()
|
|
||||||
assert 'message2' in status.getvalue()
|
|
||||||
assert 'message3' in status.getvalue()
|
|
||||||
assert 'message4' in status.getvalue()
|
|
||||||
|
|
||||||
|
|
||||||
def test_nonl_info_log(app, status, warning):
|
def test_nonl_info_log(app, status, warning):
|
||||||
logging.setup(app, status, warning)
|
logging.setup(app, status, warning)
|
||||||
@ -233,32 +215,30 @@ def test_pending_warnings(app, status, warning):
|
|||||||
|
|
||||||
|
|
||||||
def test_colored_logs(app, status, warning):
|
def test_colored_logs(app, status, warning):
|
||||||
app.verbosity = 3
|
app.verbosity = 2
|
||||||
logging.setup(app, status, warning)
|
logging.setup(app, status, warning)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# default colors
|
# default colors
|
||||||
logger.debug2('message1')
|
logger.debug('message1')
|
||||||
logger.debug('message2')
|
logger.verbose('message2')
|
||||||
logger.verbose('message3')
|
logger.info('message3')
|
||||||
logger.info('message4')
|
logger.warning('message4')
|
||||||
logger.warning('message5')
|
logger.critical('message5')
|
||||||
logger.critical('message6')
|
logger.error('message6')
|
||||||
logger.error('message7')
|
|
||||||
|
|
||||||
assert colorize('lightgray', 'message1') in status.getvalue()
|
assert colorize('darkgray', 'message1') in status.getvalue()
|
||||||
assert colorize('darkgray', 'message2') in status.getvalue()
|
assert 'message2\n' in status.getvalue() # not colored
|
||||||
assert 'message3\n' in status.getvalue() # not colored
|
assert 'message3\n' in status.getvalue() # not colored
|
||||||
assert 'message4\n' in status.getvalue() # not colored
|
assert colorize('darkred', 'WARNING: message4') in warning.getvalue()
|
||||||
assert colorize('darkred', 'WARNING: message5') in warning.getvalue()
|
assert 'WARNING: message5\n' in warning.getvalue() # not colored
|
||||||
assert 'WARNING: message6\n' in warning.getvalue() # not colored
|
assert 'WARNING: message6\n' in warning.getvalue() # not colored
|
||||||
assert 'WARNING: message7\n' in warning.getvalue() # not colored
|
|
||||||
|
|
||||||
# color specification
|
# color specification
|
||||||
logger.debug('message8', color='white')
|
logger.debug('message7', color='white')
|
||||||
logger.info('message9', color='red')
|
logger.info('message8', color='red')
|
||||||
assert colorize('white', 'message8') in status.getvalue()
|
assert colorize('white', 'message7') in status.getvalue()
|
||||||
assert colorize('red', 'message9') in status.getvalue()
|
assert colorize('red', 'message8') in status.getvalue()
|
||||||
|
|
||||||
|
|
||||||
def test_logging_in_ParallelTasks(app, status, warning):
|
def test_logging_in_ParallelTasks(app, status, warning):
|
||||||
|
Loading…
Reference in New Issue
Block a user