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

Function cbm_log_http_request

src/foundation/log.c:372–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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