Logging utility functions for Sphinx.
Unknown Field: copyright | |
Copyright 2007-2022 by the Sphinx team, see AUTHORS. | |
Unknown Field: license | |
BSD, see LICENSE for details. |
Class | SphinxLoggerAdapter |
LoggerAdapter allowing type and subtype keywords. |
Function | getLogger |
Get logger wrapped by sphinx.util.logging.SphinxLoggerAdapter . |
Function | pending_logging |
Context manager to postpone logging all logs temporarily. |
Function | pending_warnings |
Context manager to postpone logging warnings temporarily. |
Function | prefixed_warnings |
Context manager to prepend prefix to all warning log records temporarily. |
Constant | COLOR_MAP |
Undocumented |
Constant | LEVEL_NAMES |
Undocumented |
Constant | NAMESPACE |
Undocumented |
Constant | VERBOSE |
Undocumented |
Constant | VERBOSITY_MAP |
Undocumented |
Class | ColorizeFormatter |
Undocumented |
Class | DisableWarningIsErrorFilter |
Disable WarningIsErrorFilter if this filter installed. |
Class | InfoFilter |
Filter error and warning messages. |
Class | InfoLogRecordTranslator |
LogRecordTranslator for INFO level log records. |
Class | LastMessagesWriter |
Stream writer storing last 10 messages in memory to save trackback |
Class | LogCollector |
Undocumented |
Class | MemoryHandler |
Handler buffering all logs. |
Class | MessagePrefixFilter |
Prepend prefix to all log records. |
Class | NewLineStreamHandler |
StreamHandler which switches line terminator by record.nonl flag. |
Class | OnceFilter |
Show the message only once. |
Class | SafeEncodingWriter |
Stream writer which ignores UnicodeEncodeError silently |
Class | SphinxInfoLogRecord |
Info log record class supporting location |
Class | SphinxLogRecord |
Log record class supporting location |
Class | SphinxLogRecordTranslator |
Converts a log record to one Sphinx expects |
Class | SphinxWarningLogRecord |
Warning log record class supporting location |
Class | WarningIsErrorFilter |
Raise exception if warning emitted. |
Class | WarningLogRecordTranslator |
LogRecordTranslator for WARNING level log records. |
Class | WarningStreamHandler |
StreamHandler for warnings. |
Class | WarningSuppressor |
Filter logs by suppress_warnings . |
Function | convert_serializable |
Convert LogRecord serializable. |
Function | get_node_location |
Undocumented |
Function | is_suppressed_warning |
Check whether the warning is suppressed or not. |
Function | setup |
Setup root logger for Sphinx |
Function | skip_warningiserror |
Context manager to skip WarningIsErrorFilter temporarily. |
Function | suppress_logging |
Context manager to suppress logging all logs temporarily. |
Get logger wrapped by sphinx.util.logging.SphinxLoggerAdapter
.
Sphinx logger always uses sphinx.* namespace to be independent from settings of root logger. It ensures logging is consistent even if a third-party extension or imported application resets logger settings.
Example usage:
>>> from sphinx.util import logging >>> logger = logging.getLogger(__name__) >>> logger.info('Hello, this is an extension!') Hello, this is an extension!
Parameters | |
name:str | Undocumented |
Returns | |
SphinxLoggerAdapter | Undocumented |
Context manager to postpone logging all logs temporarily.
For example:
>>> with pending_logging(): >>> logger.warning('Warning message!') # not flushed yet >>> some_long_process() >>> Warning message! # the warning is flushed here
Returns | |
Generator[ | Undocumented |
Context manager to postpone logging warnings temporarily.
Similar to pending_logging
.
Returns | |
Generator[ | Undocumented |
Context manager to prepend prefix to all warning log records temporarily.
For example:
>>> with prefixed_warnings("prefix:"): >>> logger.warning('Warning message!') # => prefix: Warning message!
Parameters | |
prefix:str | Undocumented |
Returns | |
Generator[ | Undocumented |
Undocumented
Value |
|
Parameters | |
records:List[ | Undocumented |
Undocumented
Parameters | |
node:Node | Undocumented |
Returns | |
Optional[ | Undocumented |
Parameters | |
type:str | Undocumented |
subtype:str | Undocumented |
suppress_warnings:List[ | Undocumented |
Returns | |
bool | Undocumented |
Parameters | |
app:Sphinx | Undocumented |
status:IO | Undocumented |
warning:IO | Undocumented |
Parameters | |
skip:bool | Undocumented |
Returns | |
Generator[ | Undocumented |
Context manager to suppress logging all logs temporarily.
For example:
>>> with suppress_logging(): >>> logger.warning('Warning message!') # suppressed >>> some_long_process() >>>
Returns | |
Generator[ | Undocumented |