Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ You can find our backwards-compatibility policy [here](https://github.com/hynek/

- Python 3.8 support.

### Changed

- `structlog.dev.ConsoleRenderer` does not warn anymore when the `exception` key has a rendered value despite having a fancy formatter configured.
[#790](https://github.com/hynek/structlog/pull/790)


## [25.5.0](https://github.com/hynek/structlog/compare/25.4.0...25.5.0) - 2025-10-27

Expand Down
7 changes: 0 additions & 7 deletions src/structlog/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,13 +915,6 @@ def __call__(
if exc_info:
self._exception_formatter(sio, exc_info)
elif exc is not None:
if self._exception_formatter is not plain_traceback:
warnings.warn(
"Remove `format_exc_info` from your processor chain "
"if you want pretty exceptions.",
stacklevel=2,
)

sio.write("\n" + exc)

return sio.getvalue()
Expand Down
22 changes: 1 addition & 21 deletions tests/test_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,37 +358,17 @@ def test_key_values_unsorted(self, styles, padded):
+ styles.reset
) == rv

@pytest.mark.parametrize("wrap", [True, False])
def test_exception_rendered(
self, cr, recwarn, wrap, styles, padded, monkeypatch
):
def test_exception_rendered(self, cr, styles, padded):
"""
Exceptions are rendered after a new line if they are already rendered
in the event dict.

A warning is emitted if exception printing is "customized".
"""
exc = "Traceback:\nFake traceback...\nFakeError: yolo"

# Wrap the formatter to provoke the warning.
if wrap:
monkeypatch.setattr(
cr,
"_exception_formatter",
lambda s, ei: dev.plain_traceback(s, ei), # noqa: PLW0108
)

rv = cr(None, None, {"event": "test", "exception": exc})

assert (f"{padded}\n" + exc) == rv

if wrap:
(w,) = recwarn.list
assert (
"Remove `format_exc_info` from your processor chain "
"if you want pretty exceptions.",
) == w.message.args

def test_stack_info(self, cr, styles, padded):
"""
Stack traces are rendered after a new line.
Expand Down