We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1323c6c commit e5ffb21Copy full SHA for e5ffb21
1 file changed
src/mkdocstrings/loggers.py
@@ -4,10 +4,14 @@
4
from pathlib import Path
5
from typing import Any, Callable, Optional, Tuple
6
7
-from jinja2 import contextfunction
8
from jinja2.runtime import Context
9
from mkdocs.utils import warning_filter
10
+try:
11
+ from jinja2 import pass_context
12
+except ImportError: # TODO: remove once Jinja2 < 3.1 is dropped
13
+ from jinja2 import contextfunction as pass_context # noqa: WPS440
14
+
15
TEMPLATES_DIR = Path(__file__).parent / "templates"
16
17
@@ -71,7 +75,7 @@ def get_template_logger_function(logger_func: Callable) -> Callable:
71
75
A function.
72
76
"""
73
77
74
- @contextfunction
78
+ @pass_context
79
def wrapper(context: Context, msg: Optional[str] = None) -> str:
80
"""Log a message.
81
0 commit comments