Skip to content

Commit

Permalink
Deprecate mkdocs.utils.warning_filter (#3008)
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed May 4, 2023
1 parent 3c3670d commit b776ad8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mkdocs/utils/__init__.py
Expand Up @@ -464,7 +464,13 @@ def get_counts(self) -> List[Tuple[str, int]]:
return [(logging.getLevelName(k), v) for k, v in sorted(self.counts.items(), reverse=True)]


# For backward compatibility as some plugins import it.
# It is no longer necessary as all messages on the
# `mkdocs` logger get counted automatically.
warning_filter = logging.Filter()
def __getattr__(name: str):
if name == 'warning_filter':
warnings.warn(
"warning_filter doesn't do anything since MkDocs 1.2 and will be removed soon. "
"All messages on the `mkdocs` logger get counted automatically.",
DeprecationWarning,
)
return logging.Filter()

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 comments on commit b776ad8

Please sign in to comment.