Repository navigation
Honor exc_info_as_array for cached exception text - #95
Merged
Merged
Conversation
nhairs
requested changes
Oct 19, 2026
| - Replaced MyPy with Pyrefly for type checking | ||
|
|
||
| ### Fixed | ||
| - `exc_info_as_array=True` now splits cached exception text into lines when a transported log record has no `exc_info` tuple. |
|
|
||
| @pytest.mark.parametrize("class_", ALL_FORMATTERS) | ||
| @pytest.mark.parametrize("exc_info_as_array", [False, True]) | ||
| @pytest.mark.parametrize( |
Owner
There was a problem hiding this comment.
Why do we parametrize this if it's only one value?
Contributor
Author
There was a problem hiding this comment.
There are three message cases here: cached text, a string override, and a list override. I've added case names to make that clearer; the override cases check that caller-provided values still win.
| class_: type[BaseJsonFormatter], | ||
| exc_info_as_array: bool, | ||
| message: str | dict[str, Any], | ||
| ) -> None: |
Owner
There was a problem hiding this comment.
This function could do with better comments
Contributor
Author
There was a problem hiding this comment.
Added comments explaining the cached receiver state and what the override cases check.
| [project] | ||
| name = "python-json-logger" | ||
| version = "4.2.1.dev1" | ||
| version = "4.2.1.dev2" |
Contributor
Author
There was a problem hiding this comment.
Removed the version bump.
Owner
There was a problem hiding this comment.
Don't forget to add your name here
nhairs
approved these changes
Oct 20, 2026
nhairs
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #89.
Apply
exc_info_as_arrayto cached exception text as well as live tracebacks. Default string output and caller-provided exception fields stay unchanged.This comes from the local SocketHandler reproduction in #89, not a production incident. The change keeps the configured JSON field type consistent without adding a new API.
The formatter regressions and full test suite pass, along with Black, Pylint and Pyrefly.
Prepared with AI assistance.