mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-04 03:18:10 +10: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:
co-authored by
Claude Opus 5
coderabbitai[bot]
Ben Meadors
parent
5692518306
commit
cd716fe384
@@ -198,7 +198,7 @@ int callback_static_file(const struct _u_request *request, struct _u_response *r
|
||||
content_type = u_map_get_case(&configWeb.mime_types, get_filename_ext(file_requested));
|
||||
if (content_type == NULL) {
|
||||
content_type = u_map_get(&configWeb.mime_types, "*");
|
||||
LOG_DEBUG("Static File Server - Unknown mime type for extension %s ", get_filename_ext(file_requested));
|
||||
LOG_DEBUG("Static File Server - Unknown mime type for ext %s ", get_filename_ext(file_requested));
|
||||
}
|
||||
u_map_put(response->map_header, "Content-Type", content_type);
|
||||
u_map_copy_into(response->map_header, &configWeb.map_header);
|
||||
@@ -230,7 +230,7 @@ int callback_static_file(const struct _u_request *request, struct _u_response *r
|
||||
free(real_path); // realpath uses malloc
|
||||
return U_CALLBACK_CONTINUE;
|
||||
} else {
|
||||
LOG_DEBUG("Static File Server - Error, user_data is NULL or inconsistent");
|
||||
LOG_DEBUG("Static File Server - user_data NULL or inconsistent");
|
||||
return U_CALLBACK_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res,
|
||||
ulfius_set_string_body_response(res, 200, tmpa);
|
||||
// LOG_DEBUG("\n----webAPI response all:----");
|
||||
// LOG_DEBUG(tmpa);
|
||||
// LOG_DEBUG("");
|
||||
// LOG_DEBUG(".");
|
||||
}
|
||||
// Otherwise, just return one protobuf
|
||||
} else {
|
||||
@@ -312,7 +312,7 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res,
|
||||
ulfius_set_binary_body_response(res, 200, tmpa, len);
|
||||
// LOG_DEBUG("\n----webAPI response:");
|
||||
// LOG_DEBUG(tmpa);
|
||||
// LOG_DEBUG("");
|
||||
// LOG_DEBUG(".");
|
||||
}
|
||||
|
||||
// LOG_DEBUG("end radio->web", len);
|
||||
@@ -381,7 +381,7 @@ char *read_file_into_string(const char *filename)
|
||||
// reserve mem for file + 1 byte
|
||||
char *buffer = (char *)malloc(filesize + 1);
|
||||
if (buffer == NULL) {
|
||||
LOG_ERROR("Malloc of mem failed for file : %s ", filename);
|
||||
LOG_ERROR("Malloc failed for file : %s ", filename);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
@@ -406,13 +406,13 @@ int PiWebServerThread::CheckSSLandLoad()
|
||||
// read certificate
|
||||
cert_pem = read_file_into_string(CERT_PATH);
|
||||
if (cert_pem == NULL) {
|
||||
LOG_ERROR("ERROR SSL Certificate File can't be loaded or is missing");
|
||||
LOG_ERROR("SSL Certificate File can't be loaded or missing");
|
||||
return 1;
|
||||
}
|
||||
// read private key
|
||||
key_pem = read_file_into_string(KEY_PATH);
|
||||
if (key_pem == NULL) {
|
||||
LOG_ERROR("ERROR file private_key can't be loaded or is missing");
|
||||
LOG_ERROR("File private_key can't be loaded or missing");
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -479,13 +479,13 @@ PiWebServerThread::PiWebServerThread()
|
||||
webservport = portduino_config.webserverport;
|
||||
LOG_INFO("Use webserver port from yaml config %i ", webservport);
|
||||
} else {
|
||||
LOG_INFO("Webserver port in yaml config set to 0, defaulting to port 9443");
|
||||
LOG_INFO("Webserver port in yaml config 0, default to 9443");
|
||||
webservport = 9443;
|
||||
}
|
||||
|
||||
// Web Content Service Instance
|
||||
if (ulfius_init_instance(&instanceWeb, webservport, NULL, DEFAULT_REALM) != U_OK) {
|
||||
LOG_ERROR("Webserver couldn't be started, abort execution");
|
||||
LOG_ERROR("Webserver start failed, abort");
|
||||
} else {
|
||||
|
||||
LOG_INFO("Webserver started");
|
||||
@@ -534,7 +534,7 @@ PiWebServerThread::PiWebServerThread()
|
||||
LOG_INFO("Web Server framework started on port: %i ", webservport);
|
||||
LOG_INFO("Web Server root %s", (char *)webrootpath.c_str());
|
||||
} else {
|
||||
LOG_ERROR("Error starting Web Server framework, error number: %d", retssl);
|
||||
LOG_ERROR("Web Server framework start failed, err: %d", retssl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user