Skip to content

logging: audit log strings for terseness, reclaiming ~6.8 KB of string data - #11374

Open
jp-bennett wants to merge 7 commits into
developfrom
claude/meshtastic-logging-terse-2wgqmh
Open

logging: audit log strings for terseness, reclaiming ~6.8 KB of string data#11374
jp-bennett wants to merge 7 commits into
developfrom
claude/meshtastic-logging-terse-2wgqmh

Conversation

@jp-bennett

@jp-bennett jp-bennett commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Audits all 3,161 LOG_* format strings in src/ and rewrites the verbose ones to terser equivalents, reducing total log-string data from 121,628 to 114,834 bytes — 6,794 bytes saved (5.6%), with no strings dropped. A typical firmware image reclaims roughly 3–5 KB, since the biggest trims are in code nearly every target compiles (NodeDB, Router, AdminModule, MeshService, GPS, PhoneAPI, sensors).

What was changed, in passes:

  • Mechanical pass (all of src/): strip trailing ./!/... and literal \n (the logger appends a newline itself), Error:/Warning: prefixes (the level tag already conveys it), and redundant "successfully".
  • Judgment pass (top ~40 byte-heaviest files): rewrite wordy prose — "Failed to initialize X" → "X init failed", "Attempting to send" → "Send", dropped articles and filler, house abbreviations (config, init, msg, temp, BT).
  • Global pass: "Unable to / Could not / Cannot" → "Can't".
  • clang-format rewrap of lines whose length changed, using the pinned style (.trunk/configs/.clang-format, clang-format 16).

Deliberately preserved: every printf format specifier and argument list byte-for-byte (verified by an automated pre/post specifier-sequence check on every call), greppable tokens (chip/sensor/function/state names, key=value field names), the 0x%08x node/packet-ID convention, strings the external hardware-test harness greps for, and identical duplicate literals (so linker string dedup still applies). Non-log strings (UI text, NMEA/UBX, MQTT topics, CSV headers) are untouched.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

Tested via the native (portduino) target: full compile is green and the changes are string-literal-only. An automated check verified the format-specifier sequence of every LOG_* call is unchanged. Native unit-test suite run is in progress; no device-specific behavior is affected beyond log text. Community testing on real hardware is welcome but the risk surface is log prose only.

Summary by CodeRabbit

  • Style
    • Standardized diagnostic and status messages across power, lighting, GPS, displays, networking, telemetry, storage, Bluetooth, and platform integrations.
    • Shortened wording and clarified error, warning, fallback, initialization, and state-transition messages.
    • Removed inconsistent punctuation, prefixes, and embedded newline characters from logs.
    • Improved descriptions for wake events, sensor conditions, packet handling, and hardware failures.
    • No functional behavior, controls, or public interfaces changed.

claude added 5 commits August 8, 2026 14:56
…ly' from log strings

The logger already appends a newline and prints the level tag, so
trailing '.', '!', '...', literal \n, and 'Error:'/'Warning:' prefixes
inside format strings are wasted flash bytes. Same for 'successfully'
(the affirmative form already implies it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
… system code

Rewrite wordy log messages to terser equivalents - drop filler words
(articles, 'attempting', 'due to', 'please'), use 'Can't X'/'X failed'
phrasing, and abbreviate where the codebase already does (config, init,
msg, BT). Format specifiers and argument lists are unchanged; distinctive
greppable tokens are preserved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
Same terseness pass: drop filler, 'Can't X'/'X failed' phrasing, common
abbreviations (temp, msg). Specifiers, arguments, and sensor-name
prefixes unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
Same terseness pass over NodeDB, Router, MeshService, PhoneAPI,
RadioInterface, NextHopRouter, and PacketHistory: 'X failed'/'Can't X'
phrasing, imperative verbs, dropped filler. Specifiers and arguments
unchanged; duplicate literals kept identical to preserve linker string
dedup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 37769bcf-b58f-47f5-9d78-cd9aa12ea7ae

📥 Commits

Reviewing files that changed from the base of the PR and between 7f6a9f0 and 33de80d.

📒 Files selected for processing (6)
  • src/main.cpp
  • src/mesh/http/WebServer.cpp
  • src/mesh/raspihttp/PiWebServer.cpp
  • src/modules/StoreForwardModule.cpp
  • src/modules/Telemetry/Sensor/RAK9154Sensor.cpp
  • src/platform/nrf52/main-nrf52.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/platform/nrf52/main-nrf52.cpp
  • src/modules/StoreForwardModule.cpp
  • src/mesh/raspihttp/PiWebServer.cpp
  • src/main.cpp

📝 Walkthrough

Walkthrough

This PR standardizes diagnostic log wording and punctuation across firmware subsystems. It updates messages in power, GPS, graphics, mesh, telemetry, platform, security, networking, and sleep code. Runtime behavior and public interfaces remain unchanged.

Changes

Diagnostic log cleanup

Layer / File(s) Summary
Message wording normalization
src/**/*.cpp, src/**/*.h
Diagnostic messages are shortened, reworded, and standardized. Trailing punctuation, redundant prefixes, embedded newlines, and inconsistent terms are removed across affected components.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the audit and shortening of log strings, including the main memory-saving objective.
Description check ✅ Passed The description explains the scope, methods, preserved behavior, test results, and hardware-testing status in a mostly complete format.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/meshtastic-logging-terse-2wgqmh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jp-bennett jp-bennett added the cleanup Code cleanup or refactor label Aug 8, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 17

🧹 Nitpick comments (1)
src/main.cpp (1)

1370-1373: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep changed rationale comments within the two-line limit.

Both comments preserve useful security rationale, but both exceed the repository comment-length rule. Compress each block without removing the non-obvious reason.

  • src/main.cpp#L1370-L1373: reduce the four-line lockdown revert explanation to at most two lines.
  • src/modules/AdminModule.cpp#L1180-L1182: reduce the three-line admin-key rotation explanation to at most two lines.

As per coding guidelines, code comments should normally be one or two lines and should not use explanatory blocks.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main.cpp` around lines 1370 - 1373, Compress the changed rationale
comment in src/main.cpp lines 1370-1373 to no more than two lines while
retaining that the failed revert leaves the DEK file present, keeping the device
in lockdown and allowing retry. Also compress the changed admin-key rotation
comment in src/modules/AdminModule.cpp lines 1180-1182 to no more than two lines
while preserving its non-obvious security rationale; no code changes are needed.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/gps/RTC.cpp`:
- Line 141: Update the four RTC warning calls around the relevant probe and
write paths to retain a model-specific prefix identifying the RTC family, while
shortening the remaining “RTC not found” text. Preserve each warning’s existing
context and formatting arguments, including the address where currently
provided.

In `@src/main.cpp`:
- Line 457: Update the startup banner LOG_INFO call to remove the leading
embedded newline characters, while preserving the banner text and relying on
LOG_INFO to add the record newline.

In `@src/mesh/http/WebServer.cpp`:
- Line 167: Remove the LOG_DEBUG("") call from the certificate-generation flow,
while preserving the surrounding yield() and watchdog handling.

In `@src/mesh/NextHopRouter.cpp`:
- Line 70: Use canonical 32-bit node ID formatting in both affected logs: update
the NextHopRouter log at src/mesh/NextHopRouter.cpp lines 70-70 to format p->to
as 0x%08x, and update the NodeDB log at src/mesh/NodeDB.cpp lines 4334-4334 to
format both oldNodeNum and newNodeNum as 0x%08x, preserving leading zeroes.
- Line 506: Update the retransmission log in the relevant NextHopRouter flow to
remove the trailing colon and following space from the LOG_DEBUG message,
leaving the delay value as the complete log line.

In `@src/mesh/Router.cpp`:
- Line 339: Update the LOG_ERROR message in the packet-receipt handling to use
clear invalid-destination wording, such as identifying the value as to=0 or
destination 0; leave the surrounding behavior unchanged.

In `@src/mesh/wifi/WiFiAPClient.cpp`:
- Line 158: Update the LOG_ERROR call in the mDNS setup failure path to use the
message "mDNS setup failed" instead of embedding the redundant error-level word.

In `@src/modules/AdminModule.cpp`:
- Line 209: Update the LOG_INFO call in the admin validation path to format the
32-bit node ID mp.from using the canonical 0x%08x format, preserving the
existing message text and behavior.

In `@src/modules/CannedMessageModule.cpp`:
- Line 1114: Update the LOG_DEBUG call in the router-like role branch to format
dest as a zero-padded 32-bit hexadecimal value with a 0x prefix, using 0x%08x
instead of %x.

In `@src/modules/StoreForwardModule.cpp`:
- Line 633: Remove the empty LOG_INFO("") call in the StoreForwardModule
diagnostic flow, leaving the surrounding PSRAM diagnostic logging unchanged.

In `@src/modules/Telemetry/Sensor/SCD30Sensor.cpp`:
- Line 227: Update the error log in getASC() for the
scd30.getAutoCalibrationStatus(...) call to describe the failed read operation,
using wording such as “Can't get ASC status” or “Can't read ASC state” instead
of “Can't send command”.
- Line 105: Remove the embedded “Error:” text from the LOG_ERROR messages in
SCD30Sensor.cpp at lines 105, 126, 271, 291, 310, 328, and 345, preserving their
existing failure details. In HostMetrics.cpp line 54, replace the
error-level-prefixed message with a failure description such as “Can't decode
HostMetrics module”.

In `@src/modules/Telemetry/Sensor/SCD4XSensor.cpp`:
- Line 511: Update the failure logs in getAmbientPressure() and
setAmbientPressure() to say “ambient pressure” instead of “altitude”, while
preserving the existing error code output.
- Line 47: Update the LOG_ERROR messages in the SCD4XSensor error paths,
including the powerUp() call and the other referenced locations, to remove
redundant “Error” or “Error: %u” wording. Use “Can’t …” or “… failed” phrasing,
and format numeric error codes as “rc=%u”.

In `@src/platform/esp32/MeshtasticOTA.cpp`:
- Line 112: Update the warning message in the OTA partition switching code to
spell “partition” correctly and use a single separator before the reason value,
preserving the existing result argument and LOG_WARN call.

In `@src/platform/extra_variants/t_deck_pro/variant.cpp`:
- Line 122: Update the diagnostic text in the CST3530 response handling to
exactly “CST3530 no response”, removing the stray tilde and correcting the
grammar.

In `@src/platform/nrf52/main-nrf52.cpp`:
- Line 537: Remove the empty LOG_DEBUG("") call in the system-off failure
reporting path of main-nrf52.cpp; do not emit a blank log record, unless
replacing it with a meaningful diagnostic for the fallback state is required.

---

Nitpick comments:
In `@src/main.cpp`:
- Around line 1370-1373: Compress the changed rationale comment in src/main.cpp
lines 1370-1373 to no more than two lines while retaining that the failed revert
leaves the DEK file present, keeping the device in lockdown and allowing retry.
Also compress the changed admin-key rotation comment in
src/modules/AdminModule.cpp lines 1180-1182 to no more than two lines while
preserving its non-obvious security rationale; no code changes are needed.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9748fe84-c5ae-4bc8-a2e3-736bba0002b0

📥 Commits

Reviewing files that changed from the base of the PR and between 5f198c4 and f8c2841.

📒 Files selected for processing (87)
  • src/AmbientLightingThread.h
  • src/Power.cpp
  • src/PowerFSM.cpp
  • src/SafeFile.cpp
  • src/gps/GPS.cpp
  • src/gps/RTC.cpp
  • src/graphics/Screen.cpp
  • src/graphics/TFTDisplay.cpp
  • src/graphics/draw/MenuHandler.cpp
  • src/graphics/eink/Drivers/EInk.cpp
  • src/graphics/niche/Drivers/EInk/EInk.cpp
  • src/graphics/niche/Utils/FlashData.h
  • src/graphics/tftSetup.cpp
  • src/input/ButtonThread.cpp
  • src/main.cpp
  • src/mesh/CryptoEngine.cpp
  • src/mesh/IndicatorSerial.cpp
  • src/mesh/LR11x0Interface.cpp
  • src/mesh/LR20x0Interface.cpp
  • src/mesh/MemoryPool.h
  • src/mesh/MeshModule.cpp
  • src/mesh/MeshService.cpp
  • src/mesh/NextHopRouter.cpp
  • src/mesh/NodeDB.cpp
  • src/mesh/PacketHistory.cpp
  • src/mesh/PhoneAPI.cpp
  • src/mesh/ProtobufModule.h
  • src/mesh/RF95Interface.cpp
  • src/mesh/RadioInterface.cpp
  • src/mesh/RadioLibInterface.cpp
  • src/mesh/Router.cpp
  • src/mesh/SX126xInterface.cpp
  • src/mesh/WarmNodeStore.cpp
  • src/mesh/api/PacketAPI.cpp
  • src/mesh/eth/ethCert.cpp
  • src/mesh/eth/ethOTA.cpp
  • src/mesh/http/WebServer.cpp
  • src/mesh/raspihttp/PiWebServer.cpp
  • src/mesh/wifi/WiFiAPClient.cpp
  • src/modules/AdminModule.cpp
  • src/modules/CannedMessageModule.cpp
  • src/modules/ExternalNotificationModule.cpp
  • src/modules/HopScalingModule.cpp
  • src/modules/KeyVerificationModule.cpp
  • src/modules/MeshBeaconModule.cpp
  • src/modules/NeighborInfoModule.cpp
  • src/modules/NodeInfoModule.cpp
  • src/modules/PositionModule.cpp
  • src/modules/PowerStressModule.cpp
  • src/modules/RangeTestModule.cpp
  • src/modules/RemoteHardwareModule.cpp
  • src/modules/StoreForwardModule.cpp
  • src/modules/Telemetry/AirQualityTelemetry.cpp
  • src/modules/Telemetry/DeviceTelemetry.cpp
  • src/modules/Telemetry/EnvironmentTelemetry.cpp
  • src/modules/Telemetry/HealthTelemetry.cpp
  • src/modules/Telemetry/HostMetrics.cpp
  • src/modules/Telemetry/PowerTelemetry.cpp
  • src/modules/Telemetry/Sensor/BME680Sensor.cpp
  • src/modules/Telemetry/Sensor/DS248XSensor.cpp
  • src/modules/Telemetry/Sensor/NAU7802Sensor.cpp
  • src/modules/Telemetry/Sensor/RCWL9620Sensor.cpp
  • src/modules/Telemetry/Sensor/SCD30Sensor.cpp
  • src/modules/Telemetry/Sensor/SCD4XSensor.cpp
  • src/modules/Telemetry/Sensor/SEN5XSensor.cpp
  • src/modules/TraceRouteModule.cpp
  • src/modules/TrafficManagementModule.cpp
  • src/modules/esp32/PaxcounterModule.cpp
  • src/mqtt/MQTT.cpp
  • src/nimble/NimbleBluetooth.cpp
  • src/platform/esp32/ESP32CryptoEngine.cpp
  • src/platform/esp32/MeshtasticOTA.cpp
  • src/platform/esp32/main-esp32.cpp
  • src/platform/extra_variants/t5s3_epaper/variant.cpp
  • src/platform/extra_variants/t_deck_pro/variant.cpp
  • src/platform/nrf52/NRF52Bluetooth.cpp
  • src/platform/nrf52/main-nrf52.cpp
  • src/platform/nrf54l15/InternalFileSystem.cpp
  • src/platform/nrf54l15/NRF54L15Bluetooth.cpp
  • src/platform/portduino/GpsdSerial.cpp
  • src/platform/portduino/SimRadio.cpp
  • src/platform/portduino/USBHal.h
  • src/platform/rp2xx0/main-rp2xx0.cpp
  • src/platform/stm32wl/main-stm32wl.cpp
  • src/security/EncryptedStorage.cpp
  • src/serialization/MeshPacketSerializer.cpp
  • src/sleep.cpp

Comment thread src/gps/RTC.cpp
return RTCSetResultSuccess;
} else {
LOG_WARN("RTC not found (found address 0x%02X)", rtc_found.address);
LOG_WARN("RTC not found (addr 0x%02X)", rtc_found.address);

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Retain the RTC model in missing-device warnings.

The four edited warnings now use the same RTC not found literal. The surrounding code handles different RTC families, but the new messages no longer identify which probe or write path failed. Keep a model-specific prefix while shortening the remaining text.

Also applies to: 187-187, 336-336, 361-361

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gps/RTC.cpp` at line 141, Update the four RTC warning calls around the
relevant probe and write paths to retain a model-specific prefix identifying the
RTC family, while shortening the remaining “RTC not found” text. Preserve each
warning’s existing context and formatting arguments, including the address where
currently provided.

Comment thread src/main.cpp Outdated
serialSinceMsec = millis();

LOG_INFO("\n\n//\\ E S H T /\\ S T / C\n");
LOG_INFO("\n\n//\\ E S H T /\\ S T / C");

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove the embedded newlines from the startup banner.

LOG_INFO already adds the record newline. The \n\n sequence still emits extra blank lines and conflicts with the cleanup objective.

Proposed fix
-    LOG_INFO("\n\n//\\ E S H T /\\ S T / C");
+    LOG_INFO("//\\ E S H T /\\ S T / C");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOG_INFO("\n\n//\\ E S H T /\\ S T / C");
LOG_INFO("//\\ E S H T /\\ S T / C");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main.cpp` at line 457, Update the startup banner LOG_INFO call to remove
the leading embedded newline characters, while preserving the banner text and
relying on LOG_INFO to add the record newline.

Comment thread src/mesh/http/WebServer.cpp Outdated
if ((millis() / 500) % 2) {
if (runLoop) {
LOG_DEBUG(".");
LOG_DEBUG("");

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.

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

Remove the empty debug record.

LOG_DEBUG("") still emits a blank debug line during certificate generation. It adds log I/O without diagnostic content. Remove the call and keep yield() and watchdog handling.

Proposed fix
-                    LOG_DEBUG("");
                     yield();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOG_DEBUG("");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/mesh/http/WebServer.cpp` at line 167, Remove the LOG_DEBUG("") call from
the certificate-generation flow, while preserving the surrounding yield() and
watchdog handling.


p->next_hop = getNextHop(p->to, p->relay_node).value_or(NO_NEXT_HOP_PREFERENCE); // set the next hop
LOG_DEBUG("Setting next hop for packet with dest %x to %x", p->to, p->next_hop);
LOG_DEBUG("Set next hop for dest %x to %x", p->to, p->next_hop);

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use canonical formatting for all changed 32-bit node IDs.

The affected logs use inconsistent formats. Use 0x%08x at both sites to preserve leading zeroes and match firmware diagnostics.

  • src/mesh/NextHopRouter.cpp#L70-L70: format p->to as 0x%08x.
  • src/mesh/NodeDB.cpp#L4334-L4334: format oldNodeNum and newNodeNum as 0x%08x.

As per coding guidelines, format 32-bit node and packet IDs as 0x%08x.

📍 Affects 2 files
  • src/mesh/NextHopRouter.cpp#L70-L70 (this comment)
  • src/mesh/NodeDB.cpp#L4334-L4334
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/mesh/NextHopRouter.cpp` at line 70, Use canonical 32-bit node ID
formatting in both affected logs: update the NextHopRouter log at
src/mesh/NextHopRouter.cpp lines 70-70 to format p->to as 0x%08x, and update the
NodeDB log at src/mesh/NodeDB.cpp lines 4334-4334 to format both oldNodeNum and
newNodeNum as 0x%08x, preserving leading zeroes.

Source: Coding guidelines

auto d = iface->getRetransmissionMsec(pending->packet);
pending->nextTxMsec = millis() + d;
LOG_DEBUG("Setting next retransmission in %u msecs: ", d);
LOG_DEBUG("Next retransmission in %u msecs: ", d);

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the trailing colon from the retransmission log.

LOG_DEBUG terminates the line, and printPacket runs separately. The colon and trailing space do not join the packet text.

Proposed fix
-    LOG_DEBUG("Next retransmission in %u msecs: ", d);
+    LOG_DEBUG("Next retransmission in %u msecs", d);

This follows the PR objective to remove redundant trailing punctuation.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOG_DEBUG("Next retransmission in %u msecs: ", d);
LOG_DEBUG("Next retransmission in %u msecs", d);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/mesh/NextHopRouter.cpp` at line 506, Update the retransmission log in the
relevant NextHopRouter flow to remove the trailing colon and following space
from the LOG_DEBUG message, leaving the delay value as the complete log line.

LOG_INFO("%s: Found SCD41", sensorName);
if (!powerUp()) {
LOG_ERROR("%s: Error trying to execute powerUp()", sensorName);
LOG_ERROR("%s: Error executing powerUp()", sensorName);

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove redundant error-level text from LOG_ERROR messages.

These changed strings still include Error or Error: %u, although LOG_ERROR already supplies the severity. Use Can't ... or ... failed, and keep numeric codes as rc=%u.

Proposed wording pattern
-        LOG_ERROR("%s: Error executing powerUp()", sensorName);
+        LOG_ERROR("%s: powerUp() failed", sensorName);

-        LOG_ERROR("%s: Can't get temp offset. Error: %u", sensorName, error);
+        LOG_ERROR("%s: Can't get temp offset, rc=%u", sensorName, error);

Also applies to: 188-188, 427-427, 440-440, 450-450, 456-456, 487-487, 540-540, 587-587, 618-618, 660-660, 693-693

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/Telemetry/Sensor/SCD4XSensor.cpp` at line 47, Update the
LOG_ERROR messages in the SCD4XSensor error paths, including the powerUp() call
and the other referenced locations, to remove redundant “Error” or “Error: %u”
wording. Use “Can’t …” or “… failed” phrasing, and format numeric error codes as
“rc=%u”.


if (error != SCD4X_NO_ERROR) {
LOG_ERROR("%s: Unable to get altitude. Error code: %u", sensorName, error);
LOG_ERROR("%s: Can't get altitude. Error: %u", sensorName, error);

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use ambient-pressure wording in these failure logs.

Line 511 and Line 580 are in getAmbientPressure() and setAmbientPressure(), but both messages say “altitude”. The messages identify the wrong operation. Use “ambient pressure” and retain the error code.

Proposed log fix
-        LOG_ERROR("%s: Can't get altitude. Error: %u", sensorName, error);
+        LOG_ERROR("%s: Can't get ambient pressure, rc=%u", sensorName, error);

-        LOG_ERROR("%s: Can't set altitude. Error: %u", sensorName, error);
+        LOG_ERROR("%s: Can't set ambient pressure, rc=%u", sensorName, error);

Also applies to: 580-580

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/Telemetry/Sensor/SCD4XSensor.cpp` at line 511, Update the failure
logs in getAmbientPressure() and setAmbientPressure() to say “ambient pressure”
instead of “altitude”, while preserving the existing error code output.

// Partition and app checks should now be done in the AdminModule before this is called
if (result != ESP_OK) {
LOG_WARN("Unable to switch to OTA partiton. (Reason %d)", result);
LOG_WARN("Can't switch to OTA partiton. (Reason %d)", result);

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the OTA partition log typo.

The message says partiton and uses redundant punctuation. Use OTA partition and one reason separator.

Proposed wording fix
-        LOG_WARN("Can't switch to OTA partiton.  (Reason %d)", result);
+        LOG_WARN("Can't switch to OTA partition (reason %d)", result);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOG_WARN("Can't switch to OTA partiton. (Reason %d)", result);
LOG_WARN("Can't switch to OTA partition (reason %d)", result);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/platform/esp32/MeshtasticOTA.cpp` at line 112, Update the warning message
in the OTA partition switching code to spell “partition” correctly and use a
single separator before the reason value, preserving the existing result
argument and LOG_WARN call.

break;
} else {
LOG_DEBUG("CST3530 not response ~!");
LOG_DEBUG("CST3530 not response ~");

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the final diagnostic text.

Line [122] logs CST3530 not response ~. The ~ is stray, and not response is ungrammatical. Use CST3530 no response.

Proposed fix
-                LOG_DEBUG("CST3530 not response ~");
+                LOG_DEBUG("CST3530 no response");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOG_DEBUG("CST3530 not response ~");
LOG_DEBUG("CST3530 no response");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/platform/extra_variants/t_deck_pro/variant.cpp` at line 122, Update the
diagnostic text in the CST3530 response handling to exactly “CST3530 no
response”, removing the stray tilde and correcting the grammar.

Comment thread src/platform/nrf52/main-nrf52.cpp Outdated
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
@jp-bennett jp-bennett changed the title logging: strip redundant punctuation, level prefixes, and 'successfully' from log strings logging: audit log strings for terseness, reclaiming ~6.8 KB of string data Aug 8, 2026
The terseness pass over-trimmed: the Meshtastic ASCII boot logo kept its
blank line via a trailing \n, and three bare "." progress ticks were
reduced to empty strings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code cleanup or refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants