in netbench/src/trace.rs [436:466]
fn new() -> Self;
fn write<F: FnOnce(&mut Self::Io) -> std::io::Result<()>>(
&mut self,
f: F,
) -> std::io::Result<()>;
fn log(
&mut self,
id: u64,
scope: &[(u64, usize)],
verbose: bool,
now: Timestamp,
v: impl fmt::Display,
) {
let _ = self.write(|out| {
use std::io::Write;
write!(out, "{now} ")?;
write!(out, "[{id}")?;
if verbose {
for (scope, thread) in scope.iter() {
write!(out, ":{scope}.{thread}")?;
}
}
write!(out, "] ")?;
writeln!(out, "{v}")?;
Ok(())
});
}