summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2005-03-31 20:16:55 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2005-03-31 20:16:55 (GMT)
commit4a70486c37856c5e648e77e245c9a27a52fa157b (patch)
tree92f9ccbf99f6d636cf8ccb75aaaba8ffda9811c0
parenta6e8a4ad12d030de1664f1b1df27e0496dd488e9 (diff)
downloadcpython-4a70486c37856c5e648e77e245c9a27a52fa157b.zip
cpython-4a70486c37856c5e648e77e245c9a27a52fa157b.tar.gz
cpython-4a70486c37856c5e648e77e245c9a27a52fa157b.tar.bz2
Added threadName and now using re-entrant lock
-rw-r--r--Lib/logging/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index d89e0a6..e99234a 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -42,7 +42,7 @@ except ImportError:
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
__status__ = "beta"
__version__ = "0.4.9.6"
-__date__ = "12 March 2005"
+__date__ = "27 March 2005"
#---------------------------------------------------------------------------
# Miscellaneous module data
@@ -241,8 +241,10 @@ class LogRecord:
self.relativeCreated = (self.created - _startTime) * 1000
if thread:
self.thread = thread.get_ident()
+ self.threadName = threading.currentThread().getName()
else:
self.thread = None
+ self.threadName = None
if hasattr(os, 'getpid'):
self.process = os.getpid()
else:
@@ -320,6 +322,7 @@ class Formatter:
relative to the time the logging module was loaded
(typically at application startup time)
%(thread)d Thread ID (if available)
+ %(threadName)s Thread name (if available)
%(process)d Process ID (if available)
%(message)s The result of record.getMessage(), computed just as
the record is emitted
@@ -570,7 +573,7 @@ class Handler(Filterer):
Acquire a thread lock for serializing access to the underlying I/O.
"""
if thread:
- self.lock = thread.allocate_lock()
+ self.lock = threading.RLock()
else:
self.lock = None