From c00b88025dcbea932b1d755cd1409ec490f83e65 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Tue, 18 Dec 2007 23:30:50 -0700
Subject: [PATCH] mutable.Publish: improve logging

---
 src/allmydata/mutable.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/mutable.py b/src/allmydata/mutable.py
index 8fde8981..6743ee4e 100644
--- a/src/allmydata/mutable.py
+++ b/src/allmydata/mutable.py
@@ -711,7 +711,7 @@ class Publish:
         self._node = filenode
         self._storage_index = self._node.get_storage_index()
         self._log_prefix = prefix = idlib.b2a(self._storage_index)[:6]
-        num = self._node._client.log("Publish(%s): starting")
+        num = self._node._client.log("Publish(%s): starting", prefix)
         self._log_number = num
 
     def log(self, msg):
@@ -852,11 +852,14 @@ class Publish:
     def _got_query_results(self, datavs, peerid, permutedid,
                            reachable_peers, current_share_peers):
 
-        self.log("_got_query_results from %s" % idlib.shortnodeid_b2a(peerid))
+        lp = self.log("_got_query_results from %s" %
+                      idlib.shortnodeid_b2a(peerid))
         assert isinstance(datavs, dict)
         reachable_peers[peerid] = permutedid
+        if not datavs:
+            self.log("peer has no shares", parent=lp)
         for shnum, datav in datavs.items():
-            self.log(" peer has shnum %d" % shnum)
+            self.log("peer has shnum %d" % shnum, parent=lp)
             assert len(datav) == 1
             data = datav[0]
             # We want (seqnum, root_hash, IV) from all servers to know what
@@ -876,7 +879,8 @@ class Publish:
             valid = self._pubkey.verify(prefix, signature)
             if not valid:
                 self.log("WEIRD: bad signature from %s shnum %d" %
-                         (shnum, idlib.shortnodeid_b2a(peerid)))
+                         (shnum, idlib.shortnodeid_b2a(peerid)),
+                         parent=lp)
                 continue
 
             share = (shnum, seqnum, root_hash)
-- 
2.45.2