node: Simulator logging improvements

This commit is contained in:
Alexis Sellier 2023-02-10 22:09:32 +01:00
parent 42b4d95f93
commit 5f4c6edee4
No known key found for this signature in database
1 changed files with 15 additions and 4 deletions

View File

@ -84,10 +84,7 @@ impl fmt::Display for Scheduled {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.input { match &self.input {
Input::Received(from, msgs) => { Input::Received(from, msgs) => {
for msg in msgs { write!(f, "{} <- {} ({:?})", self.node, from, msgs)
write!(f, "{} <- {} ({:?})", self.node, from, msg)?;
}
Ok(())
} }
Input::Connected { Input::Connected {
id: addr, id: addr,
@ -611,6 +608,20 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
} }
} }
Io::Fetch(fetch) => { Io::Fetch(fetch) => {
if fetch.initiated {
log::info!(
target: "sim",
"{:05} {} ~> {} ({})",
self.elapsed().as_millis(), node, fetch.remote, fetch.rid
);
} else {
log::info!(
target: "sim",
"{:05} {} <~ {} ({})",
self.elapsed().as_millis(), node, fetch.remote, fetch.rid
);
}
if self.is_fallible() { if self.is_fallible() {
self.inbox.insert( self.inbox.insert(
self.time + LocalDuration::from_secs(3), self.time + LocalDuration::from_secs(3),