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

Function cbm_log_http_request

src/foundation/log.c:346–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void cbm_log_http_request(const char *component, const char *method, const char *path, int status,
347 int64_t duration_ms, size_t request_bytes, size_t response_bytes) {
348 char safe_path[CBM_SZ_1K];
349 char status_buf[CBM_SZ_16];
350 char duration_buf[CBM_SZ_32];
351 char request_buf[CBM_SZ_32];
352 char response_buf[CBM_SZ_32];
353 copy_path_without_query(path, safe_path, sizeof(safe_path));
354 snprintf(status_buf, sizeof(status_buf), "%d", status);
355 snprintf(duration_buf, sizeof(duration_buf), "%" PRId64, duration_ms);
356 snprintf(request_buf, sizeof(request_buf), "%zu", request_bytes);
357 snprintf(response_buf, sizeof(response_buf), "%zu", response_bytes);
358
359 CBMLogLevel level = CBM_LOG_INFO;
360 if (status >= 500) {
361 level = CBM_LOG_ERROR;
362 } else if (status >= 400) {
363 level = CBM_LOG_WARN;
364 }
365
366 cbm_log(level, "http.request", "component", component ? component : "", "method",
367 method ? method : "", "path", safe_path, "status", status_buf, "duration_ms",
368 duration_buf, "request_bytes", request_buf, "response_bytes", response_buf, NULL);
369}

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