MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / log_rpc

Method log_rpc

libatomic/src/daemon/state.rs:359–378  ·  view source on GitHub ↗

Append one JSONL line to the env-configured RPC log. Logging must never break a request.

(&self, method: &str, handle: Option<&RepoHandle>)

Source from the content-addressed store, hash-verified

357 /// Append one JSONL line to the env-configured RPC log. Logging must
358 /// never break a request.
359 pub fn log_rpc(&self, method: &str, handle: Option<&RepoHandle>) {
360 let Some(path) = &self.log_path else { return };
361 let record = serde_json::json!({
362 "ts": std::time::SystemTime::now()
363 .duration_since(std::time::UNIX_EPOCH)
364 .map(|d| d.as_millis() as u64)
365 .unwrap_or(0),
366 "method": method,
367 "repository_id": handle.map(|h| data_encoding::HEXLOWER.encode(&h.repository_id()[..16])),
368 "root": handle.map(|h| h.root.display().to_string()),
369 });
370 use std::io::Write;
371 if let Ok(mut file) = std::fs::OpenOptions::new()
372 .create(true)
373 .append(true)
374 .open(path)
375 {
376 let _ = writeln!(file, "{record}");
377 }
378 }
379}
380
381impl Default for DaemonState {

Callers 15

diff_working_copy_implFunction · 0.80
get_change_implFunction · 0.80
get_session_implFunction · 0.80
list_viewsMethod · 0.80
create_viewMethod · 0.80
switch_viewMethod · 0.80
delete_viewMethod · 0.80
set_view_scopeMethod · 0.80
split_viewMethod · 0.80
resolve_repositoryMethod · 0.80
register_repositoryMethod · 0.80
statusMethod · 0.80

Calls 3

openMethod · 0.45
appendMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected