mirror of
https://github.com/meshtastic/firmware.git
synced 2026-09-29 17:55:25 -04:00
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:
88 files changed
+717
-733
No files matched your search
@@ -310,7 +310,7 @@ void TraceRouteModule::updateNextHops(const meshtastic_MeshPacket &p, meshtastic
|
||||
// point any node's next_hop anywhere. relay_node is 0 for MQTT-sourced packets, which cannot
|
||||
// corroborate an RF route either.
|
||||
if (p.relay_node == NO_RELAY_NODE || nextHopByte != p.relay_node) {
|
||||
LOG_DEBUG("Ignore traceroute next-hop 0x%02x, packet was relayed by 0x%02x", nextHopByte, p.relay_node);
|
||||
LOG_DEBUG("Ignore traceroute next-hop 0x%02x, relayed by 0x%02x", nextHopByte, p.relay_node);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ void TraceRouteModule::maybeSetNextHop(NodeNum target, uint8_t nextHopByte)
|
||||
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(target);
|
||||
if (node && node->next_hop != nextHopByte) {
|
||||
LOG_INFO("Updating next-hop for 0x%08x to 0x%02x based on traceroute", target, nextHopByte);
|
||||
LOG_INFO("Update next-hop for 0x%08x to 0x%02x via traceroute", target, nextHopByte);
|
||||
node->next_hop = nextHopByte;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa
|
||||
route[*route_count] = myNodeInfo.my_node_num;
|
||||
*route_count += 1;
|
||||
} else {
|
||||
LOG_WARN("Route exceeded maximum hop limit!"); // Are you bridging networks?
|
||||
LOG_WARN("Route exceeded max hop limit"); // Are you bridging networks?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,11 +533,11 @@ const char *TraceRouteModule::getNodeName(NodeNum node)
|
||||
|
||||
bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
{
|
||||
LOG_INFO("=== TraceRoute startTraceRoute CALLED: node=0x%08x ===", node);
|
||||
LOG_INFO("TraceRoute startTraceRoute: node=0x%08x", node);
|
||||
unsigned long now = millis();
|
||||
|
||||
if (node == 0 || node == NODENUM_BROADCAST) {
|
||||
LOG_ERROR("Invalid node number for trace route: 0x%08x", node);
|
||||
LOG_ERROR("Invalid trace route node: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Invalid node");
|
||||
resultShowTime = millis();
|
||||
@@ -551,7 +551,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
}
|
||||
|
||||
if (node == nodeDB->getNodeNum()) {
|
||||
LOG_ERROR("Cannot trace route to self: 0x%08x", node);
|
||||
LOG_ERROR("Can't trace route to self: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Cannot trace self");
|
||||
resultShowTime = millis();
|
||||
@@ -567,7 +567,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
if (!initialized) {
|
||||
lastTraceRouteTime = 0;
|
||||
initialized = true;
|
||||
LOG_INFO("TraceRoute initialized for first time");
|
||||
LOG_INFO("TraceRoute first init");
|
||||
}
|
||||
|
||||
if (runState == TRACEROUTE_STATE_TRACKING) {
|
||||
@@ -587,7 +587,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
UIFrameEvent e;
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||
notifyObservers(&e);
|
||||
LOG_INFO("Cooldown active, please wait %lu seconds before starting a new trace route.", wait);
|
||||
LOG_INFO("Cooldown active, wait %lu sec before new trace route", wait);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
clearResultLines();
|
||||
bannerText = String("Tracing ") + getNodeName(node);
|
||||
|
||||
LOG_INFO("TraceRoute UI: Starting trace route to node 0x%08x, requesting focus", node);
|
||||
LOG_INFO("TraceRoute UI: Start trace to 0x%08x, request focus", node);
|
||||
|
||||
// 请求焦点,然后触发UI更新事件
|
||||
requestFocus();
|
||||
@@ -610,7 +610,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
setIntervalFromNow(1000); // 每秒检查一次状态
|
||||
|
||||
meshtastic_RouteDiscovery req = meshtastic_RouteDiscovery_init_zero;
|
||||
LOG_INFO("Creating RouteDiscovery protobuf...");
|
||||
LOG_INFO("Creating RouteDiscovery protobuf");
|
||||
|
||||
// Allocate a packet directly from router like the reference code
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
@@ -627,16 +627,16 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, &req);
|
||||
|
||||
LOG_INFO("Packet allocated successfully: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to,
|
||||
p->decoded.portnum, p->decoded.want_response, p->decoded.payload.size);
|
||||
LOG_INFO("About to call service->sendToMesh...");
|
||||
LOG_INFO("Packet allocated: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to, p->decoded.portnum,
|
||||
p->decoded.want_response, p->decoded.payload.size);
|
||||
LOG_INFO("Calling service->sendToMesh");
|
||||
|
||||
if (service) {
|
||||
LOG_INFO("MeshService is available, sending packet...");
|
||||
LOG_INFO("MeshService is available, sending packet");
|
||||
service->sendToMesh(p, RX_SRC_USER);
|
||||
LOG_INFO("sendToMesh called successfully for trace route to node 0x%08x", node);
|
||||
LOG_INFO("sendToMesh called for trace route to node 0x%08x", node);
|
||||
} else {
|
||||
LOG_ERROR("MeshService is NULL!");
|
||||
LOG_ERROR("MeshService is NULL");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Service unavailable");
|
||||
resultShowTime = millis();
|
||||
@@ -649,7 +649,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR("Failed to allocate TraceRoute packet from router");
|
||||
LOG_ERROR("TraceRoute packet alloc from router failed");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Failed to send");
|
||||
resultShowTime = millis();
|
||||
@@ -667,7 +667,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node)
|
||||
void TraceRouteModule::launch(NodeNum node)
|
||||
{
|
||||
if (node == 0 || node == NODENUM_BROADCAST) {
|
||||
LOG_ERROR("Invalid node number for trace route: 0x%08x", node);
|
||||
LOG_ERROR("Invalid trace route node: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Invalid node");
|
||||
resultShowTime = millis();
|
||||
@@ -681,7 +681,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
}
|
||||
|
||||
if (node == nodeDB->getNodeNum()) {
|
||||
LOG_ERROR("Cannot trace route to self: 0x%08x", node);
|
||||
LOG_ERROR("Can't trace route to self: 0x%08x", node);
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Cannot trace self");
|
||||
resultShowTime = millis();
|
||||
@@ -697,7 +697,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
if (!initialized) {
|
||||
lastTraceRouteTime = 0;
|
||||
initialized = true;
|
||||
LOG_INFO("TraceRoute initialized for first time");
|
||||
LOG_INFO("TraceRoute first init");
|
||||
}
|
||||
|
||||
unsigned long now = millis();
|
||||
@@ -712,7 +712,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
UIFrameEvent e;
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||
notifyObservers(&e);
|
||||
LOG_INFO("Cooldown active, please wait %lu seconds before starting a new trace route.", wait);
|
||||
LOG_INFO("Cooldown active, wait %lu sec before new trace route", wait);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
setIntervalFromNow(1000);
|
||||
|
||||
meshtastic_RouteDiscovery req = meshtastic_RouteDiscovery_init_zero;
|
||||
LOG_INFO("Creating RouteDiscovery protobuf...");
|
||||
LOG_INFO("Creating RouteDiscovery protobuf");
|
||||
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
if (p) {
|
||||
@@ -746,21 +746,21 @@ void TraceRouteModule::launch(NodeNum node)
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, &req);
|
||||
|
||||
LOG_INFO("Packet allocated successfully: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to,
|
||||
p->decoded.portnum, p->decoded.want_response, p->decoded.payload.size);
|
||||
LOG_INFO("Packet allocated: to=0x%08x, portnum=%d, want_response=%d, payload_size=%d", p->to, p->decoded.portnum,
|
||||
p->decoded.want_response, p->decoded.payload.size);
|
||||
|
||||
if (service) {
|
||||
service->sendToMesh(p, RX_SRC_USER);
|
||||
LOG_INFO("sendToMesh called successfully for trace route to node 0x%08x", node);
|
||||
LOG_INFO("sendToMesh called for trace route to node 0x%08x", node);
|
||||
} else {
|
||||
LOG_ERROR("MeshService is NULL!");
|
||||
LOG_ERROR("MeshService is NULL");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Service unavailable");
|
||||
resultShowTime = millis();
|
||||
tracingNode = 0;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR("Failed to allocate TraceRoute packet from router");
|
||||
LOG_ERROR("TraceRoute packet alloc from router failed");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("Failed to send");
|
||||
resultShowTime = millis();
|
||||
@@ -775,7 +775,7 @@ void TraceRouteModule::handleTraceRouteResult(const String &result)
|
||||
resultShowTime = millis();
|
||||
tracingNode = 0;
|
||||
|
||||
LOG_INFO("TraceRoute result ready, requesting focus. Result: %s", result.c_str());
|
||||
LOG_INFO("TraceRoute result ready, request focus: %s", result.c_str());
|
||||
|
||||
setIntervalFromNow(1000);
|
||||
|
||||
@@ -784,7 +784,7 @@ void TraceRouteModule::handleTraceRouteResult(const String &result)
|
||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||
notifyObservers(&e);
|
||||
|
||||
LOG_INFO("=== TraceRoute handleTraceRouteResult END ===");
|
||||
LOG_INFO("TraceRoute handleTraceRouteResult END");
|
||||
}
|
||||
|
||||
bool TraceRouteModule::shouldDraw()
|
||||
@@ -850,7 +850,7 @@ int32_t TraceRouteModule::runOnce()
|
||||
|
||||
// Check for tracking timeout
|
||||
if (runState == TRACEROUTE_STATE_TRACKING && now - lastTraceRouteTime > trackingTimeoutMs) {
|
||||
LOG_INFO("TraceRoute timeout, no response received");
|
||||
LOG_INFO("TraceRoute timeout, no response");
|
||||
runState = TRACEROUTE_STATE_RESULT;
|
||||
setResultText("No response received");
|
||||
resultShowTime = now;
|
||||
@@ -886,7 +886,7 @@ int32_t TraceRouteModule::runOnce()
|
||||
return 1000;
|
||||
} else {
|
||||
// Cooldown finished
|
||||
LOG_INFO("TraceRoute cooldown finished, returning to IDLE");
|
||||
LOG_INFO("TraceRoute cooldown done, return to IDLE");
|
||||
runState = TRACEROUTE_STATE_IDLE;
|
||||
resultText = "";
|
||||
clearResultLines();
|
||||
|
||||
Reference in new issue
Block a user