[core] support unbraced $name fields in $ style formats - #69
Merged
nhairs merged 3 commits intoAug 15, 2026
Conversation
BaseJsonFormatter.parse() matched only ${name} for StringTemplateStyle,
so a format like "$asctime $message" produced no fields at all and the
resulting log records were missing every requested attribute. Python's
string.Template accepts both $name and ${name}.
The regex now matches both forms and skips the $$ escape, and parse()
picks whichever group matched.
Closes nhairs#18
nhairs
force-pushed
the
fix/string-template-unbraced-names
branch
from
August 15, 2026 10:59
c48cdca to
81d368f
Compare
nhairs
approved these changes
Aug 15, 2026
nhairs
left a comment
Owner
There was a problem hiding this comment.
Thanks for your work on this @Sanjays2402
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.
Closes #18
parse()matched only${name}forStringTemplateStyle, so a$-style format like"$asctime $levelname $message"returned no fields at all and the emitted JSON was missing every requested attribute.string.Templateaccepts both$nameand${name}, so the regex now matches both and skips the$$escape.New
test_string_template_formatsits besidetest_percentage_format/test_comma_formatintests/test_formatters.pyand covers both forms plus$$; it fails on the current regex and passes with the fix.This change was prepared with AI assistance; the regression test was run locally and fails without the fix.