in eden/scm/lib/blackbox/src/event.rs [558:764]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use Event::*;
match self {
Alias { from, to } => write!(f, "[command_alias] {:?} expands to {:?}", from, to)?,
Blocked {
op,
name,
duration_ms,
} => match name {
Some(name) => write!(
f,
"[blocked] {:?} ({}) blocked for {} ms",
op, name, duration_ms
)?,
None => write!(f, "[blocked] {:?} blocked for {} ms", op, duration_ms)?,
},
CommitCloudSync {
op,
version,
added_heads,
removed_heads,
added_bookmarks,
removed_bookmarks,
added_remote_bookmarks,
removed_remote_bookmarks,
} => {
let direction = match op {
CommitCloudSyncOp::ToCloud => "to",
CommitCloudSyncOp::FromCloud => "from",
};
write!(
f,
"[commit_cloud_sync] sync {} cloud version {}",
direction, version
)?;
if added_heads.len > 0 {
write!(f, "; heads added {}", added_heads)?;
}
if removed_heads.len > 0 {
write!(f, "; heads removed {}", removed_heads)?;
}
if added_bookmarks.len > 0 {
write!(f, "; bookmarks added {}", added_bookmarks)?;
}
if removed_bookmarks.len > 0 {
write!(f, "; bookmarks removed {}", removed_bookmarks)?;
}
if added_remote_bookmarks.len > 0 {
write!(f, "; remote bookmarks added {}", added_remote_bookmarks)?;
}
if removed_remote_bookmarks.len > 0 {
write!(f, "; remote bookmarks removed {}", removed_remote_bookmarks)?;
}
}
Config { items, interactive } => {
let interactive = if *interactive {
"interactive"
} else {
"non-interactive"
};
write!(
f,
"[config] {} {}",
interactive,
items
.iter()
.map(|(k, v)| format!("{}={}", k, v))
.collect::<Vec<_>>()
.join(" ")
)?;
}
ClientTelemetry {
peer_name,
peer_info,
} => write!(
f,
"[clienttelemetry] peer name: {} {}",
peer_name,
peer_info
.iter()
.map(|(k, v)| format!("{}={}", k, v))
.collect::<Vec<_>>()
.join(" ")
)?,
Debug { value } => write!(f, "[debug] {}", json_to_string(value))?,
Exception { msg } => write!(f, "[command_exception] {}", msg)?,
Finish {
exit_code,
max_rss,
duration_ms,
timestamp_ms: _,
} => {
write!(
f,
"[commmand_finish] exited {} in {} ms, max RSS: {} bytes",
exit_code, duration_ms, max_rss
)?;
}
FsmonitorQuery {
old_clock,
old_files,
new_clock,
new_files,
is_error,
is_fresh,
} => {
let msg = if *is_error {
"query failed".to_string()
} else if *is_fresh {
format!(
"clock: {:?} -> {:?}; need check: {} + all files",
old_clock, new_clock, old_files
)
} else {
format!(
"clock: {:?} -> {:?}; need check: {} + {}",
old_clock, new_clock, old_files, new_files
)
};
write!(f, "[fsmonitor] {}", msg)?;
}
LegacyLog {
service,
msg,
opts: _,
} => {
write!(f, "[legacy][{}] {}", service, msg,)?;
}
Network {
op,
read_bytes,
write_bytes,
calls,
duration_ms,
latency_ms,
session_id,
url,
result,
} => {
let result = match result {
Some(result) => format!(" with result {}", json_to_string(result)),
None => "".to_string(),
};
write!(
f,
"[network] {:?} finished in {} calls, duration {} ms, latency {} ms, read {} bytes, write {} bytes, session id {}, url {}{}",
op,
calls,
duration_ms,
latency_ms,
read_bytes,
write_bytes,
session_id,
url,
result,
)?;
}
Start {
pid,
uid,
nice,
args,
timestamp_ms: _,
} => {
write!(
f,
"[command] {:?} started by uid {} as pid {} with nice {}",
args, uid, pid, nice
)?;
}
PerfTrace { msg } => write!(f, "[perftrace] {}", msg)?,
ProcessTree { names, pids } => {
write!(f, "[process_tree]")?;
for (name, pid) in names.iter().rev().zip(pids.iter().rev()) {
write!(f, " {} ({}) ->", name, pid)?;
}
write!(f, " (this process)")?;
}
Profile { msg } => write!(f, "[profile] {}", msg)?,
Tags { names } => write!(f, "[tags] {}", names.join(", "))?,
TracingData { serialized } => {
write!(f, "[tracing] (binary data of {} bytes)", serialized.0.len())?
}
Watchman {
args,
duration_ms,
result,
} => {
let result = match result {
Some(result) => format!(" with result {}", json_to_string(result)),
None => "".to_string(),
};
write!(
f,
"[watchman] command {} finished in {} ms{}",
json_to_string(args),
duration_ms,
result,
)?;
}
_ => {
// Fallback to "Debug"
write!(f, "[uncategorized] {:?}", self)?;
}
}
Ok(())
}