]> granicus.if.org Git - python/commitdiff
Added logThreads and logProcesses to allow conditional omission of logging this infor...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 13 Mar 2006 22:05:28 +0000 (22:05 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 13 Mar 2006 22:05:28 +0000 (22:05 +0000)
Lib/logging/__init__.py

index 853b606ebb249fff3b0a61c2e672abb72c37dea3..d82d6671b35ba9999c0877baac85bbc7ac4d1173 100644 (file)
@@ -89,6 +89,16 @@ _startTime = time.time()
 #
 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
 #---------------------------------------------------------------------------
@@ -243,13 +253,13 @@ class LogRecord:
         self.created = ct
         self.msecs = (ct - long(ct)) * 1000
         self.relativeCreated = (self.created - _startTime) * 1000
-        if thread:
+        if logThreads and thread:
             self.thread = thread.get_ident()
             self.threadName = threading.currentThread().getName()
         else:
             self.thread = None
             self.threadName = None
-        if hasattr(os, 'getpid'):
+        if logProcesses and hasattr(os, 'getpid'):
             self.process = os.getpid()
         else:
             self.process = None