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

Function cbm_progress_sink_fn

src/cli/progress_sink.c:432–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432void cbm_progress_sink_fn(const char *line) {
433 progress_sink_mutex_ensure();
434 cbm_mutex_lock(&s_sink_mutex);
435 if (!line || !s_out) {
436 cbm_mutex_unlock(&s_sink_mutex);
437 return;
438 }
439 char level[CBM_SZ_32] = {0};
440 if (!extract_kv(line, "level", level, (int)sizeof(level))) {
441 cbm_mutex_unlock(&s_sink_mutex);
442 return;
443 }
444 if (strcmp(level, "warn") == 0 || strcmp(level, "error") == 0) {
445 passthrough_line(line);
446 cbm_mutex_unlock(&s_sink_mutex);
447 return;
448 }
449 if (strcmp(level, "debug") == 0) {
450 if (s_preserve_details) {
451 passthrough_line(line);
452 }
453 cbm_mutex_unlock(&s_sink_mutex);
454 return;
455 }
456 if (strcmp(level, "info") != 0) {
457 cbm_mutex_unlock(&s_sink_mutex);
458 return;
459 }
460
461 char msg[CBM_SZ_64] = {0};
462 if (!extract_kv(line, "msg", msg, (int)sizeof(msg))) {
463 cbm_mutex_unlock(&s_sink_mutex);
464 return;
465 }
466 for (int i = 0; i < HANDLER_COUNT; i++) {
467 if (strcmp(msg, handlers[i].msg) == 0) {
468 handlers[i].handler(line);
469 cbm_mutex_unlock(&s_sink_mutex);
470 return;
471 }
472 }
473 if (s_preserve_details) {
474 passthrough_line(line);
475 }
476 cbm_mutex_unlock(&s_sink_mutex);
477}

Callers 3

test_cli.cFile · 0.85
cli_progress_race_workerFunction · 0.85

Calls 5

cbm_mutex_lockFunction · 0.85
cbm_mutex_unlockFunction · 0.85
extract_kvFunction · 0.85
passthrough_lineFunction · 0.85

Tested by 2

cli_progress_race_workerFunction · 0.68