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

Function capture_route_log_sink

tests/test_pipeline.c:6362–6376  ·  view source on GitHub ↗

Keeps only the route decisions; worker threads log too, and only the * appends need serialising. */

Source from the content-addressed store, hash-verified

6360/* Keeps only the route decisions; worker threads log too, and only the
6361 * appends need serialising. */
6362static void capture_route_log_sink(const char *line) {
6363 if (!line || !strstr(line, "pipeline.route")) {
6364 return;
6365 }
6366 while (atomic_flag_test_and_set_explicit(&g_route_log_spin, memory_order_acquire)) {}
6367 size_t used = strlen(g_route_log_capture);
6368 size_t avail = sizeof(g_route_log_capture) - used;
6369 if (avail > 1) {
6370 int n = snprintf(g_route_log_capture + used, avail, "%s\n", line);
6371 if (n < 0 || (size_t)n >= avail) {
6372 g_route_log_capture[sizeof(g_route_log_capture) - 1] = '\0';
6373 }
6374 }
6375 atomic_flag_clear_explicit(&g_route_log_spin, memory_order_release);
6376}
6377
6378/* #1864: a first index has no previous generation. The route probe used to
6379 * open the run's own EMPTY stage placeholder, fail its integrity check, and

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected