8000
Skip to content

[esp32_hosted] Combine log statements to reduce loop blocking - #12884

Merged
bdraco merged 1 commit into
devfrom
combine-logs-esp32_hosted
Jan 4, 2026
Merged

[esp32_hosted] Combine log statements to reduce loop blocking#12884
bdraco merged 1 commit into
devfrom
combine-logs-esp32_hosted

Conversation

@bdraco
@bdraco bdraco commented Jan 4, 2026
Copy link
Copy Markdown
Member

What does this implement/fix?

Combine consecutive log statements into single calls using multi-line string literals.

Logging is one of the most intensive operations in ESPHome and blocks the event loop longer than most other operations. Each ESP_LOG* call involves formatting, memory allocation, serial output, and network packet transmission. Combining consecutive log statements reduces event loop blocking and the number of network packets sent to connected clients.

Note: The log processor reformats multi-line output so each line gets its own timestamp and log level prefix - the final output format is unchanged. Minor reordering of dump_config output may occur when LOG_PIN or other logging macros cannot be combined with ESP_LOG* calls - this is acceptable as it does not affect functionality.

See https://developers.esphome.io/architecture/logging/ for more details.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Developer breaking change (an API change that could break external components)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

Pull request in esphome-docs with documentation (if applicable):

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • nRF52840

Example entry for config.yaml:

# N/A - no config changes

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

Copilot AI review requested due to automatic review settings January 4, 2026 02:09
@bdraco
bdraco requested a review from swoboda1337 as a code owner January 4, 2026 02:09
@codecov-commenter
codecov-commenter commented Jan 4, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.42%. Comparing base (5d384c7) to head (959ea17).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #12884   +/-   ##
=======================================
  Coverage   73.42%   73.42%           
=======================================
  Files          53       53           
  Lines       11303    11303           
  Branches     1534     1534           
=======================================
  Hits         8299     8299           
  Misses       2604     2604           
  Partials      400      400           

☔ 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.

@github-actions
github-actions Bot commented Jan 4, 2026
Copy link
Copy Markdown
Contributor

👋 Hi there! I've automatically requested reviews from codeowners based on the files changed in this PR.

@swoboda1337 - You've been requested to review this PR as codeowner(s) of 1 file(s) that were modified. Thanks for your time! 🙏

@github-actions
github-actions Bot commented Jan 4, 2026
Copy link
Copy Markdown
Contributor

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#12884
    components: [esp32_hosted]
    refresh: 1h

(Added by the PR bot)

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@bdraco
bdraco commented Jan 4, 2026
Copy link
Copy Markdown
Member Author

thanks

@bdraco
bdraco merged commit 1e70091 into dev Jan 4, 2026
42 checks passed
@bdraco
bdraco deleted the combine-logs-esp32_hosted branch January 4, 2026 18:28
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0