Skip to content

Don't error out when logging non-JSON serialisable values#516

Merged
itamarst merged 3 commits into
itamarst:masterfrom
mathrick:fix-unserialisable-json
May 7, 2026
Merged

Don't error out when logging non-JSON serialisable values#516
itamarst merged 3 commits into
itamarst:masterfrom
mathrick:fix-unserialisable-json

Conversation

@mathrick

Copy link
Copy Markdown

The serialiser now falls back on repr() to ensure some usable value can always be logged, even if no other serialiser exists for the value.

Fixes #515

@mathrick

Copy link
Copy Markdown
Author

Is there anything else needed to move this forward?

@mathrick

Copy link
Copy Markdown
Author

@itamarst: ping?

@itamarst

Copy link
Copy Markdown
Owner

Sorry, must've missed this.

And I guess I thought it was an OK idea back then. At minimum should use eliot._util.saferepr instead, but I may have more review comments; I'll try to get back to this when I'm done upgrading my various libraries to support Python 3.14.

The serialiser now falls back on repr() to ensure some usable value
can always be logged, even if no other serialiser exists for the
value.

Fixes itamarst#515
@mathrick mathrick force-pushed the fix-unserialisable-json branch from ddc9c31 to 458bcf7 Compare January 22, 2026 07:41
@mathrick

Copy link
Copy Markdown
Author

Done, I've also adjusted the tests so they pass again.

@itamarst itamarst merged commit 3c2e959 into itamarst:master May 7, 2026
6 checks passed
@itamarst

itamarst commented May 7, 2026

Copy link
Copy Markdown
Owner

Thank you!

@itamarst

itamarst commented May 7, 2026

Copy link
Copy Markdown
Owner

This has been released as 1.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging fails when non JSON-serialisable arguments or return values are present

3 participants