Skip to content

Commit

Permalink
Log deprecation in MkDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Oct 16, 2023
1 parent e05d4e8 commit 5ec5fa8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions materialx/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import xml.etree.ElementTree as etree # noqa: N813
import warnings
from functools import wraps
import logging

log = logging.getLogger('mkdocs')

DEPRECATED = """
Material emoji logic has been officially moved into mkdocs-material
Expand All @@ -32,6 +35,13 @@
RES_PATH = os.path.join(RESOURCES, '.icons')


@functools.lru_cache(maxsize=None)
def log_msg(message):
"""Log message."""

log.warn(message)


def deprecated(message, stacklevel=2, name=None): # pragma: no cover
"""
Raise a `DeprecationWarning` when wrapped function/method is called.
Expand All @@ -51,6 +61,8 @@ def _deprecated_func(*args, **kwargs):
category=DeprecationWarning,
stacklevel=stacklevel
)

log_msg(message)
return func(*args, **kwargs)
return _deprecated_func
return _wrapper
Expand Down

0 comments on commit 5ec5fa8

Please sign in to comment.