MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_log_http_request

Function cbm_log_http_request

src/foundation/log.c:380–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380void cbm_log_http_request(const char *component, const char *method, const char *path, int status,
381 int64_t duration_ms, size_t request_bytes, size_t response_bytes) {
382 char safe_path[CBM_SZ_1K];
383 char status_buf[CBM_SZ_16];
384 char duration_buf[CBM_SZ_32];
385 char request_buf[CBM_SZ_32];
386 char response_buf[CBM_SZ_32];
387 copy_path_without_query(path, safe_path, sizeof(safe_path));
388 snprintf(status_buf, sizeof(status_buf), "%d", status);
389 snprintf(duration_buf, sizeof(duration_buf), "%" PRId64, duration_ms);
390 snprintf(request_buf, sizeof(request_buf), "%zu", request_bytes);
391 snprintf(response_buf, sizeof(response_buf), "%zu", response_bytes);
392
393 CBMLogLevel level = CBM_LOG_INFO;
394 if (status >= 500) {
395 level = CBM_LOG_ERROR;
396 } else if (status >= 400) {
397 level = CBM_LOG_WARN;
398 }
399
400 cbm_log(level, "http.request", "component", component ? component : "", "method",
401 method ? method : "", "path", safe_path, "status", status_buf, "duration_ms",
402 duration_buf, "request_bytes", request_buf, "response_bytes", response_buf, NULL);
403}

Callers 2

cbm_http_server_runFunction · 0.85
test_log.cFile · 0.85

Calls 2

copy_path_without_queryFunction · 0.85
cbm_logFunction · 0.85

Tested by

no test coverage detected