Conversation
Signed-off-by: Christopher Pruijsen <christopher.pruijsen@gmail.com>
cpruijsen
force-pushed
the
fix/issue-190
branch
from
September 11, 2026 13:57
ae7c16c to
8031d93
Compare
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.
FluentRecordFormatterno longer overwrites fmt-dictmessagewith the unstructured fallback when the fmt dict already definesmessage._structuringused to replace that field with the full log text after the fmt dict had already applied specifiers such as%(message).5s. Other fmt keys were not overwritten, which is why onlymessagelooked broken (#190). Dict and JSON-object merges still last-write-win.Decision
Skip the fallback only when the fmt dict has a
messagekey. The other options are to make_add_dicnever overwrite existing keys, or to skip wheneverdataalready hasmessage. The README describesmessageas an additional key for string logs; changing_add_dicwould change payload-wins-on-overlap for dict/JSON, and testingdatawould changeexclude_attrstraceback melding. Can switch if format keys should always win.Reporter expected
"message":"mingl"in #190, from"%(message).5s"on"mingle: searching for neighbors". Stdlib%formatting produces that truncation; the fmt dict already did too, before the overwrite.If a fmt dict contains
"message": "%(message)s",messageis now the stdlibLogRecord.message(no traceback). Use%(exc_text)sfor the traceback, as in the issue's config. Omittingmessagefrom the fmt dict is unchanged and still includes traceback in the addedmessagefield.Test plan
test_custom_fmt_truncates_message: reporter case; fails without the fix, passes with ittest_custom_fmt_truncates_non_string_message:log.info(42)with%(message).1s(same overwrite on the non-string branch)tests/test_handler.pyandtests/test_asynchandler.pystill pass; fullpytest tests74 passed, 2 skippedlogging.configdict