[tor-commits] [bridgedb/master] Only log netstatus descriptor fields if they were parsed.

isis at torproject.org isis at torproject.org
Sun Jan 12 06:06:35 UTC 2014


commit 40d39d583c7392111cbe57fa816c8e119180a74d
Author: Isis Lovecruft <isis at torproject.org>
Date:   Sun Jan 5 17:23:46 2014 +0000

    Only log netstatus descriptor fields if they were parsed.
    
     * CHANGE bridgedb.Bridges.parseStatusFile() to only log networkstatus
       descriptor fields if the parsers were actually able to parse
       them. Otherwise we waste a lot of log lines with blank values.
---
 lib/bridgedb/Bridges.py |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/bridgedb/Bridges.py b/lib/bridgedb/Bridges.py
index 01de8b7..328cd2e 100644
--- a/lib/bridgedb/Bridges.py
+++ b/lib/bridgedb/Bridges.py
@@ -508,11 +508,12 @@ def parseStatusFile(networkstatusFile):
             logging.debug("Parsed networkstatus line:")
             logging.debug("  Nickname:   %s" % nickname)
             logging.debug("  Identity:   %s" % toHex(ID))
-            logging.debug("  Descriptor: %s" % descDigest)
-            logging.debug("  Timestamp:  %s" % timestamp)
-            logging.debug("  ORAddress:  %s" % ORaddr)
-            logging.debug("  ORport:     %s" % ORport)
-            logging.debug("  dirport:    %s" % dirport)
+            if descDigest:
+                logging.debug("  Descriptor: {0}".format(toHex(descDigest)))
+                logging.debug("  Timestamp:  {0}".format(timestamp))
+                logging.debug("  ORAddress:  {0}".format(ORaddr))
+                logging.debug("  ORport:     {0}".format(ORport))
+                logging.debug("  dirport:    {0}".format(dirport))
 
         elif ID and line.startswith("a "):
             try:





More information about the tor-commits mailing list