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

Function host_log_open

src/daemon/host.c:124–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124static bool host_log_open(char conflict_log_out[HOST_PATH_CAP]) {
125 const char *cache = cbm_resolve_cache_dir();
126 if (!cache || !cache[0] || !conflict_log_out) {
127 return false;
128 }
129 char logs[HOST_PATH_CAP];
130 int written = snprintf(logs, sizeof(logs), "%s/logs", cache);
131 if (written <= 0 || written >= (int)sizeof(logs)) {
132 return false;
133 }
134 written = snprintf(conflict_log_out, HOST_PATH_CAP, "%s/daemon-conflicts.ndjson", logs);
135 if (written <= 0 || written >= HOST_PATH_CAP) {
136 return false;
137 }
138 g_host_log_file =
139 cbm_daemon_ipc_private_log_open(logs, "cbm-daemon.log", HOST_OPERATION_LOG_CAP);
140 if (!g_host_log_file) {
141 conflict_log_out[0] = '\0';
142 return false;
143 }
144 cbm_mutex_init(&g_host_log_mutex);
145 g_host_log_mutex_initialized = true;
146 cbm_log_set_sink(host_log_sink);
147 return true;
148}
149
150/* #1828: a detached daemon has no stderr; its start failure must reach the
151 * client that is waiting for it, or that client burns its whole deadline and

Calls 4

cbm_resolve_cache_dirFunction · 0.85
cbm_mutex_initFunction · 0.85
cbm_log_set_sinkFunction · 0.85

Tested by

no test coverage detected