Skip to content

Commit

Permalink
Don't truncate debug logs for emitted events
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Aug 1, 2024
1 parent f893408 commit df871ab
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sphinx/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from __future__ import annotations

import contextlib
from collections import defaultdict
from operator import attrgetter
from typing import TYPE_CHECKING, Any, NamedTuple
Expand Down Expand Up @@ -90,8 +89,12 @@ def emit(
"""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'))
Expand Down

0 comments on commit df871ab

Please sign in to comment.