Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Picard log entries have inaccurate timestamp (PICARD-45)

  • Loading branch information...
commit 7c6d08d1ae61fa28b504ad41663f5b8b0878c20a 1 parent b31e952
Michael Wiencek authored June 02, 2012
1  NEWS.txt
@@ -21,6 +21,7 @@ Version 1.0 - 2012-06-XX
21 21
  * Remove .DS_Store, desktop.ini, and Thumbs.db from otherwise empty directories (PICARD-75)
22 22
  * Update artist translation to use new alias features (primary flag, sort names) (PICARD-200)
23 23
  * Deleted tags aren't indicated as changes (PICARD-165)
  24
+ * Picard log entries have inaccurate timestamp (PICARD-45)
24 25
 
25 26
 Version 0.16 - 2011-10-23
26 27
  * Added AcoustID support.
9  picard/log.py
@@ -24,8 +24,8 @@
24 24
 from picard.util import thread
25 25
 
26 26
 
27  
-def _stderr_receiver(prefix, msg):
28  
-    sys.stderr.write("%s %s %s %s%s" % (prefix, str(QtCore.QThread.currentThreadId()), str(QtCore.QTime.currentTime().toString()), msg, os.linesep))
  27
+def _stderr_receiver(prefix, time, msg):
  28
+    sys.stderr.write("%s %s %s %s%s" % (prefix, str(QtCore.QThread.currentThreadId()), time, msg, os.linesep))
29 29
 
30 30
 
31 31
 class Log(object):
@@ -45,15 +45,16 @@ def _message(self, prefix, message, args, kwargs):
45 45
         if args:
46 46
             message = message % args
47 47
         prefix = "%s" % (prefix,)
  48
+        time = str(QtCore.QTime.currentTime().toString())
48 49
         message = "%s" % (message,)
49 50
         if isinstance(prefix, unicode):
50 51
             prefix = prefix.encode("utf-8", "replace")
51 52
         if isinstance(message, unicode):
52 53
             message = message.encode("utf-8", "replace")
53  
-        self.entries.append((prefix, message))
  54
+        self.entries.append((prefix, time, message))
54 55
         for func in self.receivers:
55 56
             try:
56  
-                func(prefix, message)
  57
+                func(prefix, time, message)
57 58
             except Exception, e:
58 59
                 import traceback
59 60
                 traceback.print_exc()
8  picard/ui/logview.py
@@ -38,13 +38,13 @@ def __init__(self, parent=None):
38 38
         self.browser.setDocument(self.doc)
39 39
         vbox = QtGui.QHBoxLayout(self)
40 40
         vbox.addWidget(self.browser)
41  
-        for prefix, msg in log.entries:
42  
-            self.add_entry(prefix, msg)
  41
+        for prefix, time, msg in log.entries:
  42
+            self.add_entry(prefix, time, msg)
43 43
         log.add_receiver(self.add_entry)
44 44
 
45  
-    def add_entry(self, prefix, msg):
  45
+    def add_entry(self, prefix, time, msg):
46 46
         self.textCursor.movePosition(QtGui.QTextCursor.End)
47  
-        self.textCursor.insertText(prefix + ' ' + str(QtCore.QThread.currentThreadId()) + ' ' + QtCore.QTime.currentTime().toString() + ' ' + msg, self.textFormat)
  47
+        self.textCursor.insertText(prefix + ' ' + str(QtCore.QThread.currentThreadId()) + ' ' + time + ' ' + msg, self.textFormat)
48 48
         self.textCursor.insertBlock()
49 49
         sb = self.browser.verticalScrollBar()
50 50
         sb.setValue(sb.maximum())

0 notes on commit 7c6d08d

Please sign in to comment.
Something went wrong with that request. Please try again.