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

Function cbm_ui_log_append

src/ui/http_server.c:433–445  ·  view source on GitHub ↗

Called from a log hook — appends a line to the ring buffer (thread-safe) */

Source from the content-addressed store, hash-verified

431
432/* Called from a log hook — appends a line to the ring buffer (thread-safe) */
433void cbm_ui_log_append(const char *line) {
434 if (!line)
435 return;
436 /* Ensure mutex is initialized (safe for early single-threaded logging
437 * and concurrent calls via atomic_exchange once-init pattern). */
438 cbm_ui_log_init();
439 cbm_mutex_lock(&g_log_mutex);
440 snprintf(g_log_ring[g_log_head], LOG_LINE_MAX, "%s", line);
441 g_log_head = (g_log_head + 1) % LOG_RING_SIZE;
442 if (g_log_count < LOG_RING_SIZE)
443 g_log_count++;
444 cbm_mutex_unlock(&g_log_mutex);
445}
446
447/* Append a printf-formatted fragment at *pos within a bufsz buffer, never
448 * advancing *pos past bufsz. snprintf returns the length it WOULD have written,

Callers 2

host_log_sinkFunction · 0.85
test_httpd.cFile · 0.85

Calls 3

cbm_ui_log_initFunction · 0.85
cbm_mutex_lockFunction · 0.85
cbm_mutex_unlockFunction · 0.85

Tested by

no test coverage detected