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

* logging: strip redundant punctuation, level prefixes, and 'successfully' 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

* logging: tighten verbose log strings in modules, radio, platform, and 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

* logging: tighten verbose log strings in telemetry sensors and GPS

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

* logging: tighten verbose log strings in mesh core

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

* logging: 'Unable to/Could not/Cannot' -> "Can't" in log strings

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

* logging: clang-format rewrap after string shortening

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

* logging: restore boot-logo trailing newline and progress-dot strings

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

* Update src/mesh/wifi/WiFiAPClient.cpp

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* logging: address review feedback on the terseness audit

- Node/packet IDs use the repo's 0x%08x convention in NextHopRouter,
  NodeDB, AdminModule and CannedMessageModule. The sibling log in each
  if/else pair is converted too, so a pair isn't split across two formats.
  next_hop stays 0x%x - it's the last-byte relay hint, not a NodeNum.
- RTC: the read-path and set-path "not found" warnings were byte-identical,
  so the linker deduped them and the log couldn't say which one fired.
  Split into "RTC read:" / "RTC set:". (The four sites live in mutually
  exclusive #ifdef branches, so the RTC family was never ambiguous.)
- SCD4X getAmbientPressure()/setAmbientPressure() logged "altitude", and
  SCD30 getASC() logged "Can't send command" for a read. Both now name the
  operation they actually perform.
- LOG_ERROR already carries the level: ". Error: %u" -> ", rc=%u" (matching
  the existing rc=%d house style) and "Error executing X()" -> "X() failed".
- Typos and wording: "OTA partiton.  (Reason" -> "OTA partition (reason",
  "CST3530 not response ~" -> "CST3530 no response", "Packet received with
  to: of 0" -> "to=0", HostMetrics "Error decoding" -> "Can't decode", and
  the dangling ": " on the NextHopRouter retransmission line.

Printf specifier sequences are byte-identical on all 37 touched lines apart
from the 6 deliberate %x/%u -> %08x node-ID widenings, all on uint32_t args.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Jonathan Bennett
2026-08-10 01:02:19 +00:00
committed by GitHub
co-authored by Claude Opus 5 coderabbitai[bot] Ben Meadors
parent 5692518306
commit cd716fe384
88 changed files with 717 additions and 733 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ class ESP32CryptoEngine : public CryptoEngine
sizeof(scratch) - numBytes); // Fill rest of buffer with zero (in case cypher looks at it)
mbedtls_aes_crypt_ctr(&aes, numBytes, &nc_off, _nonce, stream_block, scratch, bytes);
} else {
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption!", numBytes);
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption", numBytes);
}
}
}
+2 -2
View File
@@ -102,14 +102,14 @@ bool trySwitchToOTA()
const esp_partition_t *part = getAppPartition();
if (part == NULL) {
LOG_WARN("Unable to get app partition in preparation of OTA reboot");
LOG_WARN("Can't get app partition in preparation of OTA reboot");
return false;
}
uint8_t result = esp_ota_set_boot_partition(part);
// 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 partition (reason %d)", result);
return false;
}
+5 -5
View File
@@ -69,7 +69,7 @@ static bool shouldReleaseBluetoothMemory()
// Paxcounter disables the Meshtastic BLE service, but libpax still needs the
// ESP32 BLE controller memory for scanning.
if (isPaxcounterActiveForBoot()) {
LOG_DEBUG("Skipping Bluetooth memory release because Paxcounter is active");
LOG_DEBUG("Skip BT memory release: Paxcounter active");
return false;
}
@@ -96,7 +96,7 @@ void setBluetoothEnable(bool enable)
if (enable && bluetoothMemoryReleased) {
if (!shouldReleaseBluetoothMemory() && !bluetoothMemoryReleaseWarned) {
bluetoothMemoryReleaseWarned = true;
LOG_WARN("Bluetooth memory has been released; reboot to re-enable Bluetooth");
LOG_WARN("BT memory released; reboot to re-enable");
}
return;
}
@@ -205,7 +205,7 @@ void enableSlowCLK()
LOG_DEBUG("32k XTAL OSC has not started up");
} else {
rtc_clk_slow_freq_set(RTC_SLOW_FREQ_32K_XTAL);
LOG_DEBUG("Switch RTC Source to 32.768kHz succeeded, using 32k XTAL");
LOG_DEBUG("RTC source now 32k XTAL");
CALIBRATE_ONE(RTC_CAL_RTC_MUX);
CALIBRATE_ONE(RTC_CAL_32K_XTAL);
}
@@ -285,14 +285,14 @@ void esp32Setup()
};
res = esp_task_wdt_init(&wdt_config);
if (res == ESP_ERR_INVALID_STATE) {
LOG_WARN("Task watchdog already initialized, reconfiguring existing instance");
LOG_WARN("Task watchdog already init, reconfiguring");
res = esp_task_wdt_reconfigure(&wdt_config);
}
assert(res == ESP_OK);
#else
res = esp_task_wdt_init(APP_WATCHDOG_SECS, true);
if (res == ESP_ERR_INVALID_STATE) {
LOG_WARN("Task watchdog already initialized, reusing existing instance");
LOG_WARN("Task watchdog already init, reusing");
res = ESP_OK;
}
assert(res == ESP_OK);
@@ -696,7 +696,7 @@ void lateInitVariant()
#endif
} else {
touchControllerReady = false;
LOG_ERROR("Failed to find touch controller!");
LOG_ERROR("Failed to find touch controller");
}
#if defined(BOARD_PCA9535_ADDR) && defined(BOARD_PCA9535_BUTTON_MASK)
@@ -119,7 +119,7 @@ void lateInitVariant()
break;
} else {
LOG_DEBUG("CST3530 not response ~!");
LOG_DEBUG("CST3530 no response");
}
}
uint8_t cmd1[] = {0xD0, 0x00, 0x04, 0x00};
+4 -4
View File
@@ -255,7 +255,7 @@ void NRF52Bluetooth::startDisabled()
// Shutdown bluetooth for minimum power draw
Bluefruit.Advertising.stop();
Bluefruit.setTxPower(-40); // Minimum power
LOG_INFO("Disable NRF52 Bluetooth. (Workaround: tx power min, advertise stopped)");
LOG_INFO("Disable NRF52 BT (tx power min, advertise stopped)");
}
bool NRF52Bluetooth::isConnected()
{
@@ -283,7 +283,7 @@ void NRF52Bluetooth::setup()
// current Bluefruit config. Without this check the node would silently run without BLE.
// Rebuild with -DCFG_DEBUG=1 to get "SoftDevice's RAM requires: 0x..." in the log, then
// raise the ORIGIN accordingly.
LOG_ERROR("Bluefruit.begin failed - SoftDevice RAM reservation too small for this config");
LOG_ERROR("Bluefruit.begin failed: SoftDevice RAM too small");
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_UNSPECIFIED);
return;
}
@@ -399,7 +399,7 @@ void updateBatteryLevel(uint8_t level)
}
void NRF52Bluetooth::clearBonds()
{
LOG_INFO("Clear bluetooth bonds!");
LOG_INFO("Clear bluetooth bonds");
bond_print_list(BLE_GAP_ROLE_PERIPH);
bond_print_list(BLE_GAP_ROLE_CENTRAL);
Bluefruit.Periph.clearBonds();
@@ -481,7 +481,7 @@ void NRF52Bluetooth::disconnect()
delay(1);
if (Bluefruit.connected())
LOG_WARN("BLE disconnect unconfirmed after %ums, continuing shutdown", millis() - start);
LOG_WARN("BLE disconnect unconfirmed after %ums, shutdown anyway", millis() - start);
else
LOG_INFO("Ended BLE connection");
}
+2 -2
View File
@@ -419,7 +419,7 @@ void nrf52Setup()
#ifdef BQ25703A_ADDR
auto *bq = new BQ25713();
if (!bq->setup())
LOG_ERROR("ERROR! Charge controller init failed");
LOG_ERROR("Charge controller init failed");
#endif
// Init random seed
@@ -526,7 +526,7 @@ void cpuDeepSleep(uint32_t msecToWake)
auto ok = sd_power_system_off();
if (ok != NRF_SUCCESS) {
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!");
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off");
NRF_POWER->SYSTEMOFF = 1;
}
}
+1 -1
View File
@@ -77,7 +77,7 @@ bool InternalFileSystem::begin()
}
// Mount failed: attempt to format (creates a fresh LittleFS)
LOG_WARN("LittleFS mount failed (%d), formatting storage partition...", rc);
LOG_WARN("LittleFS mount failed (%d), formatting storage partition", rc);
int fmt_rc = fs_mkfs(FS_LITTLEFS, (uintptr_t)FIXED_PARTITION_ID(storage_partition), NULL, 0);
if (fmt_rc != 0) {
LOG_ERROR("LittleFS format failed (%d)", fmt_rc);
+3 -3
View File
@@ -442,7 +442,7 @@ static void security_changed_cb(struct bt_conn *conn, bt_security_t level, enum
if (err == BT_SECURITY_ERR_PIN_OR_KEY_MISSING) {
// Phone has a stale bond (device was wiped/reflashed). Unpair the stale
// entry so the phone re-pairs cleanly on the next connection attempt.
LOG_WARN("BLE stale bond detected (key missing) - unpairing");
LOG_WARN("BLE stale bond (key missing) - unpairing");
bt_unpair(BT_ID_DEFAULT, bt_conn_get_dst(conn));
bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);
} else if (err) {
@@ -691,7 +691,7 @@ static bool nrf54l15_bt_init_common()
// instead of leaving BLE silently broken.
if (config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) {
LOG_WARN("BLE: NO_PIN not supported on nRF54L15-DK (MITM-only build); "
"treating as RANDOM_PIN");
"treat as RANDOM_PIN");
}
bt_conn_auth_cb_register(&auth_cb);
@@ -759,7 +759,7 @@ void NRF54L15Bluetooth::startDisabled()
return;
}
ble_enabled = false;
LOG_INFO("BLE initialized, advertising stopped (startDisabled)");
LOG_INFO("BLE initialized, adv stopped (startDisabled)");
}
void NRF54L15Bluetooth::resumeAdvertising()
+1 -1
View File
@@ -115,7 +115,7 @@ bool GpsdSerial::connectToGpsd()
std::string portStr = std::to_string(_port);
if (getaddrinfo(_host.c_str(), portStr.c_str(), &hints, &res) != 0 || !res) {
LOG_WARN("gpsdSerial: could not resolve %s", _host.c_str());
LOG_WARN("gpsdSerial: can't resolve %s", _host.c_str());
return false;
}
+6 -6
View File
@@ -238,7 +238,7 @@ void SimRadio::startSend(meshtastic_MeshPacket *txp)
memcpy(&c.data.bytes, p->encrypted.bytes, p->encrypted.size);
c.data.size = p->encrypted.size;
} else {
LOG_WARN("Encrypted payload (%u) exceeds sim loopback capacity (%u)! Send empty payload", (unsigned)p->encrypted.size,
LOG_WARN("Encrypted payload (%u) > sim loopback capacity (%u), send empty", (unsigned)p->encrypted.size,
(unsigned)loopbackCapacity);
}
} else {
@@ -248,7 +248,7 @@ void SimRadio::startSend(meshtastic_MeshPacket *txp)
memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size);
c.data.size = p->decoded.payload.size;
} else {
LOG_WARN("Payload size larger than compressed message allows! Send empty payload");
LOG_WARN("Payload > compressed max, send empty");
}
}
@@ -295,7 +295,7 @@ void SimRadio::unpackAndReceive(meshtastic_MeshPacket &p)
p.decoded.portnum = scratch.portnum;
}
} else
LOG_ERROR("Error decoding proto for simulator message!");
LOG_ERROR("Error decoding proto for simulator message");
}
// Let SimRadio receive as if it did via its LoRa chip
startReceive(&p);
@@ -305,7 +305,7 @@ void SimRadio::startReceive(meshtastic_MeshPacket *p)
{
#ifdef USERPREFS_SIMRADIO_EMULATE_COLLISIONS
if (isActivelyReceiving()) {
LOG_WARN("Collision detected, dropping current and previous packet!");
LOG_WARN("Collision detected, dropping current and previous packet");
rxBad++;
airTime->logAirtime(RX_ALL_LOG, getPacketTime(receivingPacket, true));
packetPool.release(receivingPacket);
@@ -319,7 +319,7 @@ void SimRadio::startReceive(meshtastic_MeshPacket *p)
} else if ((interval - airtimeLeft) > preambleTimeMsec) {
// Only if transmitting for longer than preamble there is a collision
// (channel should actually be detected as active otherwise)
LOG_WARN("Collision detected during transmission!");
LOG_WARN("Collision detected during transmission");
return;
}
}
@@ -359,7 +359,7 @@ void SimRadio::handleReceiveInterrupt()
}
if (!isReceiving) {
LOG_DEBUG("*** WAS_ASSERT *** handleReceiveInterrupt called when not in receive mode");
LOG_DEBUG("*** WAS_ASSERT *** handleReceiveInterrupt outside receive mode");
return;
}
+3 -3
View File
@@ -89,7 +89,7 @@ class Ch341Hal : public RadioLibHal
}
auto res = pinedio_set_pin_mode(&pinedio, pin, mode);
if (res < 0 && rebootAtMsec == 0) {
LOG_ERROR("USBHal pinMode: Could not set pin %u mode to %u: %d", pin, mode, res);
LOG_ERROR("USBHal pinMode: Can't set pin %u mode to %u: %d", pin, mode, res);
}
}
@@ -103,7 +103,7 @@ class Ch341Hal : public RadioLibHal
}
auto res = pinedio_digital_write(&pinedio, pin, value);
if (res < 0 && rebootAtMsec == 0) {
LOG_ERROR("USBHal digitalWrite: Could not write pin %u: %d", pin, res);
LOG_ERROR("USBHal digitalWrite: Can't write pin %u: %d", pin, res);
portduino_status.LoRa_in_error = true;
}
}
@@ -118,7 +118,7 @@ class Ch341Hal : public RadioLibHal
}
auto res = pinedio_digital_read(&pinedio, pin);
if (res < 0 && rebootAtMsec == 0) {
LOG_ERROR("USBHal digitalRead: Could not read pin %u: %d", pin, res);
LOG_ERROR("USBHal digitalRead: Can't read pin %u: %d", pin, res);
portduino_status.LoRa_in_error = true;
return 0;
}
+1 -1
View File
@@ -111,7 +111,7 @@ bool getDeviceId(uint8_t *deviceId)
void rp2040Setup()
{
if (watchdog_caused_reboot()) {
LOG_WARN("Rebooted by watchdog!");
LOG_WARN("Rebooted by watchdog");
}
/* Sets a random seed to make sure we get different random numbers on each boot. */
+1 -1
View File
@@ -146,7 +146,7 @@ void cpuDeepSleep(uint32_t msecToWake)
if (!stm32wlRtcAvailable()) {
// Hardware can't shutdown, but firmware has already prepared itself for shutdown
// Do not leave the device unresponsive, reset instead
LOG_WARN("STM32WL: hardware RTC failed, cannot deep sleep/shutdown");
LOG_WARN("STM32WL: hardware RTC failed, can't deep sleep/shutdown");
if (Serial) {
Serial.flush();
Serial.end();