Skip to content

Commit 0bf2b5e

Browse files
committed
reduce log spam from frontend polling
- Muted logs for automatically polled endpoints (`/list_payloads`, etc.) - Added explicit log line for process kill requests to keep track of terminated PIDs
1 parent 293f44b commit 0bf2b5e

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

src/http_server.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,27 @@ struct UploadStatus {
105105
char repo_url[512];
106106
};
107107

108+
/* ── Helper: Noisy routes ──────────────────────────────────── */
109+
110+
/* Filter out endpoints that the frontend polls automatically to reduce log spam */
111+
static int is_noisy_route(const char *url) {
112+
if (strcmp(url, ROUTE_LOG) == 0) return 1;
113+
if (strcmp(url, ROUTE_INDEX) == 0) return 1;
114+
if (strcmp(url, ROUTE_INDEX_HTML) == 0) return 1;
115+
if (strcmp(url, "/favicon.svg") == 0) return 1;
116+
if (strcmp(url, "/icon.png") == 0) return 1;
117+
if (strcmp(url, ROUTE_CACHE_MANIFEST) == 0) return 1;
118+
if (strcmp(url, ROUTE_GETIP) == 0) return 1;
119+
if (strcmp(url, ROUTE_AUTOLOAD_STATUS) == 0) return 1;
120+
if (strcmp(url, ROUTE_VERSION) == 0) return 1;
121+
if (strcmp(url, ROUTE_LIST_PAYLOADS) == 0) return 1;
122+
if (strcmp(url, ROUTE_GET_CONFIG) == 0) return 1;
123+
if (strcmp(url, ROUTE_REPO_LIST) == 0) return 1;
124+
if (strcmp(url, ROUTE_PROCESSES_LIST) == 0) return 1;
125+
if (strcmp(url, "/events") == 0) return 1;
126+
return 0;
127+
}
128+
108129
/* ── Main request handler ──────────────────────────────────── */
109130

110131
enum MHD_Result http_on_request(void *cls, struct MHD_Connection *conn,
@@ -456,9 +477,7 @@ enum MHD_Result http_on_request(void *cls, struct MHD_Connection *conn,
456477
}
457478

458479
/* ── Log significant requests ──────────────────────────── */
459-
if (strcmp(url, ROUTE_LOG) != 0 && strcmp(url, ROUTE_INDEX) != 0 &&
460-
strcmp(url, ROUTE_INDEX_HTML) != 0 && strcmp(url, "/favicon.svg") != 0 &&
461-
strcmp(url, "/icon.png") != 0) {
480+
if (!is_noisy_route(url)) {
462481
pldmgr_log("[PLDMGR] Request: %s %s\n", method, url);
463482
}
464483

@@ -604,6 +623,9 @@ enum MHD_Result http_on_request(void *cls, struct MHD_Connection *conn,
604623
}
605624
int pid = atoi(pid_str);
606625
int rc = process_kill(pid);
626+
627+
pldmgr_log("[PLDMGR] Process kill requested for PID %d: %s\n", pid, rc == 0 ? "SUCCESS" : "FAILED");
628+
607629
char json_resp[256];
608630
snprintf(json_resp, sizeof(json_resp), "{\"ok\":%s,\"message\":\"%s\"}",
609631
rc == 0 ? "true" : "false", rc == 0 ? "Killed" : "Failed to kill");

0 commit comments

Comments
 (0)