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

Function host_log_open

src/daemon/host.c:123–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123static bool host_log_open(char conflict_log_out[HOST_PATH_CAP]) {
124 const char *cache = cbm_resolve_cache_dir();
125 if (!cache || !cache[0] || !conflict_log_out) {
126 return false;
127 }
128 char logs[HOST_PATH_CAP];
129 int written = snprintf(logs, sizeof(logs), "%s/logs", cache);
130 if (written <= 0 || written >= (int)sizeof(logs)) {
131 return false;
132 }
133 written = snprintf(conflict_log_out, HOST_PATH_CAP, "%s/daemon-conflicts.ndjson", logs);
134 if (written <= 0 || written >= HOST_PATH_CAP) {
135 return false;
136 }
137 g_host_log_file =
138 cbm_daemon_ipc_private_log_open(logs, "cbm-daemon.log", HOST_OPERATION_LOG_CAP);
139 if (!g_host_log_file) {
140 conflict_log_out[0] = '\0';
141 return false;
142 }
143 cbm_mutex_init(&g_host_log_mutex);
144 g_host_log_mutex_initialized = true;
145 cbm_log_set_sink(host_log_sink);
146 return true;
147}
148
149static void host_log_close(void) {
150 cbm_log_set_sink(NULL);

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