Don't truncate debug logs for emitted events

This commit is contained in:
Adam Turner 2024-08-01 08:06:10 +01:00
parent f893408dff
commit df871ab15b

View File

@ -5,7 +5,6 @@ Gracefully adapted from the TextPress system by Armin.
from __future__ import annotations
import contextlib
from collections import defaultdict
from operator import attrgetter
from typing import TYPE_CHECKING, Any, NamedTuple
@ -90,8 +89,12 @@ class EventManager:
"""Emit a Sphinx event."""
# not every object likes to be repr()'d (think
# random stuff coming via autodoc)
with contextlib.suppress(Exception):
logger.debug('[app] emitting event: %r%s', name, repr(args)[:100])
try:
repr_args = repr(args)
except Exception:
pass
else:
logger.debug('[app] emitting event: %r%s', name, repr_args)
results = []
listeners = sorted(self.listeners[name], key=attrgetter('priority'))