print thread name on trace

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3206 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2006-05-16 17:00:49 +00:00
parent 0bb2970222
commit c6b5759c39

View file

@ -18,10 +18,8 @@ import re
import linecache
import time
import sys
try:
import thread as _thread
except ImportError:
import dummy_thread as _thread
import thread
import threading
# tracing
_trace_ignore = set()
@ -88,8 +86,10 @@ def _trace_line (frame, event, arg):
if filename.endswith(".pyc") or filename.endswith(".pyo"):
filename = filename[:-1]
line = linecache.getline(filename, lineno)
print "THREAD(%d) %.2f %s # %s:%d" % \
(_thread.get_ident(), time.time(), line.rstrip(), name, lineno)
tid = thread.get_ident()
tname = threading.currentThread().getName()
args = (tid, tname, time.time(), line.rstrip(), name, lineno)
print "THREAD(%d) %r %.2f %s # %s:%d" % args
def trace_on (full=False):