[Python-checkins] r43013 - python/trunk/Lib/logging/__init__.py

vinay.sajip python-checkins at python.org
Mon Mar 13 23:05:29 CET 2006


Author: vinay.sajip
Date: Mon Mar 13 23:05:28 2006
New Revision: 43013

Modified:
   python/trunk/Lib/logging/__init__.py
Log:
Added logThreads and logProcesses to allow conditional omission of logging this information

Modified: python/trunk/Lib/logging/__init__.py
==============================================================================
--- python/trunk/Lib/logging/__init__.py	(original)
+++ python/trunk/Lib/logging/__init__.py	Mon Mar 13 23:05:28 2006
@@ -89,6 +89,16 @@
 #
 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 @@
         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


More information about the Python-checkins mailing list