[Pcsclite-cvs-commit] r6080 - /trunk/PCSC/src/spy/pcsc-spy.py

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Oct 25 12:54:07 UTC 2011


Author: rousseau
Date: Tue Oct 25 12:54:07 2011
New Revision: 6080

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6080
Log:
Use a 4 spaces indentation for each thread

Modified:
    trunk/PCSC/src/spy/pcsc-spy.py

Modified: trunk/PCSC/src/spy/pcsc-spy.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy.py?rev=6080&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy.py (original)
+++ trunk/PCSC/src/spy/pcsc-spy.py Tue Oct 25 12:54:07 2011
@@ -160,25 +160,25 @@
         data = " => " + code + " (" + rv_text + " [" + rv + "]) "
         if "0x00000000" != rv:
             if self.color:
-                print PCSCspy.color_red + data + PCSCspy.color_normal + time
+                print self.indent + PCSCspy.color_red + data + PCSCspy.color_normal + time
             else:
-                print data + time
+                print self.indent + data + time
         else:
-            print data + time
+            print self.indent + data + time
 
     def log_in(self, line):
         """ generic log for IN line """
         if self.color:
-            print PCSCspy.color_green + " i " + line + PCSCspy.color_normal
+            print self.indent + PCSCspy.color_green + " i " + line + PCSCspy.color_normal
         else:
-            print " i " + line
+            print self.indent + " i " + line
 
     def log_out(self, line):
         """ generic log for OUT line """
         if self.color:
-            print PCSCspy.color_magenta + " o " + line + PCSCspy.color_normal
+            print self.indent + PCSCspy.color_magenta + " o " + line + PCSCspy.color_normal
         else:
-            print " o " + line
+            print self.indent + " o " + line
 
     def log_in_multi(self, lines, padding=""):
         """ generic log for IN lines """
@@ -366,9 +366,9 @@
     def log_name(self, name):
         """ log function name """
         if self.color:
-            print PCSCspy.color_blue + name + PCSCspy.color_normal
+            print self.indent + PCSCspy.color_blue + name + PCSCspy.color_normal
         else:
-            print name
+            print self.indent + name
 
     def _log_readers(self, readers, direction):
         """ log SCARD_READERSTATE structure """
@@ -658,7 +658,7 @@
         self.log_in_hCard()
         self._log_rv()
 
-    def __init__(self, queue, stats, color=True):
+    def __init__(self, queue, stats, indent, color=True):
         """ constructor """
 
         # communication queue
@@ -666,6 +666,7 @@
 
         self.color = color
         self.stats = stats
+        self.indent = " " * indent
 
         self.features = {0x01: "FEATURE_VERIFY_PIN_START",
             0x02: "FEATURE_VERIFY_PIN_FINISH",
@@ -799,6 +800,7 @@
         self.stats = dict()
 
         threads = dict()
+        indent = 0
 
         # dispatch
         line = self.filedesc2.readline().strip()
@@ -815,9 +817,10 @@
             except KeyError:
                 queue = self.queues[thread] = Queue()
                 # new worker
-                spy = PCSCspy(queue, self.stats, self.color)
+                spy = PCSCspy(queue, self.stats, indent, self.color)
                 threads[thread] = Thread(target=spy.worker)
                 threads[thread].start()
+                indent += 4
 
             queue.put(tail)
 




More information about the Pcsclite-cvs-commit mailing list