Skip to content

fix(logger): preserve percent-style formatting args in flush_buffer#8009

Merged
leandrodamascena merged 2 commits intodevelopfrom
fix/flush-buffer-percent-style-formatting
Feb 27, 2026
Merged

fix(logger): preserve percent-style formatting args in flush_buffer#8009
leandrodamascena merged 2 commits intodevelopfrom
fix/flush-buffer-percent-style-formatting

Conversation

@dreamorosi
Copy link
Contributor

Issue number: closes #8005

Summary

Changes

Fixed _create_and_flush_log_record method to preserve percent-style formatting arguments when flushing buffered log records. Changed hardcoded args=() to args=log_line.get("args", ()) to use the arguments stored in the buffer.

User experience

Before: Buffered logs with percent-style formatting (e.g., logger.debug("user=%s count=%d", "alice", 42)) would flush as literal format strings: "user=%s count=%d"

After: Buffered logs are properly interpolated when flushed: "user=alice count=42"


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

- Fix _create_and_flush_log_record to use stored args from buffer
- Add test for percent-style formatting in buffered logs
- Resolves issue where format strings were not interpolated on flush

Fixes #8005
@dreamorosi dreamorosi requested a review from a team as a code owner February 26, 2026 15:23
@dreamorosi dreamorosi requested a review from anafalcao February 26, 2026 15:23
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 26, 2026
@github-actions github-actions bot added the bug Something isn't working label Feb 26, 2026
@dreamorosi dreamorosi self-assigned this Feb 26, 2026
@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.73%. Comparing base (bdd2d1f) to head (975564f).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8009   +/-   ##
========================================
  Coverage    96.73%   96.73%           
========================================
  Files          278      278           
  Lines        13654    13657    +3     
  Branches      1086     1086           
========================================
+ Hits         13208    13211    +3     
  Misses         327      327           
  Partials       119      119           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dreamorosi dreamorosi changed the title fix: preserve percent-style formatting args in flush_buffer fix(logger): preserve percent-style formatting args in flush_buffer Feb 26, 2026
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome as a new Python contributor @dreamorosi 😄!

Thanks for working on this, man! APPROVED.

@sonarqubecloud
Copy link

@leandrodamascena leandrodamascena merged commit aa969f7 into develop Feb 27, 2026
15 checks passed
@leandrodamascena leandrodamascena deleted the fix/flush-buffer-percent-style-formatting branch February 27, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working logger size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: flush_buffer discards args - percent-style log interpolation broken for buffered records

2 participants