Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Simulator logging improvements
Alexis Sellier committed 3 years ago
commit 5f4c6edee448fc89bf5bc67631abcce82a2d5a27
parent 42b4d95f93f0cc9e0e798bc3354bd73fd29509ae
1 file changed +15 -4
modified radicle-node/src/test/simulator.rs
@@ -84,10 +84,7 @@ impl fmt::Display for Scheduled {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match &self.input {
            Input::Received(from, msgs) => {
-
                for msg in msgs {
-
                    write!(f, "{} <- {} ({:?})", self.node, from, msg)?;
-
                }
-
                Ok(())
+
                write!(f, "{} <- {} ({:?})", self.node, from, msgs)
            }
            Input::Connected {
                id: addr,
@@ -611,6 +608,20 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
                }
            }
            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() {
                    self.inbox.insert(
                        self.time + LocalDuration::from_secs(3),