title: How to obtain a Thread id in Python?
body: <p>I have a multi-threading Python program, and a utility function, <code>writeLog(message)</code>, that writes out a timestamp followed by the message. Unfortunately, the resultant log file gives no indication of which thread is generating which message. </p>
  
  <p>I would like <code>writeLog()</code> to be able to add something to the message to identify which thread is calling it. Obviously I could just make the threads pass this information in, but that would be a lot more work. Is there some thread equivalent of <code>os.getpid()</code> that I could use?</p>