Skip to content

Truncate logs during formatting - #247

Merged
JonatanWaern merged 1 commit into
mainfrom
extern-optimizations
Nov 2, 2026
Merged

JonatanWaern merged 1 commit into
mainfrom
extern-optimizations

Conversation

@JonatanWaern

Copy link
Copy Markdown
Contributor

Signed-off-by: Jonatan Waern jonatan.waern@intel.com

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the change to truncate log messages during formatting.

No open issues 🎉

What changed in this PR

This PR truncates log messages during formatting rather than after building the full string, reducing unnecessary allocations and formatting work.

Changes:

  • Adds a length-limited writer that stops formatting when the byte limit is exceeded while preserving UTF-8 boundaries.
  • Adds tests for formatting options, early termination, Unicode boundaries, and formatter errors.
  • Documents the logging improvement in the changelog.
File Description
src/​logging.rs Implements truncation during formatting and adds regression tests.
CHANGELOG.md Records the reduction in allocations from large debug messages.

Review effort: Balanced

@TSonono TSonono left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

@JonatanWaern
JonatanWaern merged commit 73f46a9 into main Nov 2, 2026
5 checks passed
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.

3 participants