diff options
Diffstat (limited to 'sphinx/util/logging.py')
-rw-r--r-- | sphinx/util/logging.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py index bdf77dc07..ef36e3cf1 100644 --- a/sphinx/util/logging.py +++ b/sphinx/util/logging.py @@ -111,14 +111,21 @@ class SphinxInfoLogRecord(SphinxLogRecord): class SphinxWarningLogRecord(SphinxLogRecord): """Warning log record class supporting location""" - prefix = 'WARNING: ' + @property + def prefix(self) -> str: # type: ignore + if self.levelno >= logging.CRITICAL: + return 'CRITICAL: ' + elif self.levelno >= logging.ERROR: + return 'ERROR: ' + else: + return 'WARNING: ' class SphinxLoggerAdapter(logging.LoggerAdapter): """LoggerAdapter allowing ``type`` and ``subtype`` keywords.""" KEYWORDS = ['type', 'subtype', 'location', 'nonl', 'color', 'once'] - def log(self, level: Union[int, str], msg: str, *args: Any, **kwargs: Any) -> None: + def log(self, level: Union[int, str], msg: str, *args: Any, **kwargs: Any) -> None: # type: ignore # NOQA if isinstance(level, int): super().log(level, msg, *args, **kwargs) else: |