From c6b5759c39220370de589a61884b4e11d6b539ec Mon Sep 17 00:00:00 2001 From: calvin Date: Tue, 16 May 2006 17:00:49 +0000 Subject: [PATCH] print thread name on trace git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3206 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/trace.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linkcheck/trace.py b/linkcheck/trace.py index 621047f6..ba72c11c 100644 --- a/linkcheck/trace.py +++ b/linkcheck/trace.py @@ -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):