Added logThreads and logProcesses to allow conditional omission of logging this information

This commit is contained in:
Vinay Sajip 2006-03-13 22:05:28 +00:00
parent 6da8cebe3c
commit d364a07517
1 changed files with 12 additions and 2 deletions

View File

@ -89,6 +89,16 @@ _startTime = time.time()
# #
raiseExceptions = 1 raiseExceptions = 1
#
# If you don't want threading information in the log, set this to zero
#
logThreads = 1
#
# If you don't want process information in the log, set this to zero
#
logProcesses = 1
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Level related stuff # Level related stuff
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -243,13 +253,13 @@ class LogRecord:
self.created = ct self.created = ct
self.msecs = (ct - long(ct)) * 1000 self.msecs = (ct - long(ct)) * 1000
self.relativeCreated = (self.created - _startTime) * 1000 self.relativeCreated = (self.created - _startTime) * 1000
if thread: if logThreads and thread:
self.thread = thread.get_ident() self.thread = thread.get_ident()
self.threadName = threading.currentThread().getName() self.threadName = threading.currentThread().getName()
else: else:
self.thread = None self.thread = None
self.threadName = None self.threadName = None
if hasattr(os, 'getpid'): if logProcesses and hasattr(os, 'getpid'):
self.process = os.getpid() self.process = os.getpid()
else: else:
self.process = None self.process = None