Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d364a07

Browse files
committed
Added logThreads and logProcesses to allow conditional omission of logging this information
1 parent 6da8ceb commit d364a07

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Lib/logging/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def currentframe():
8989
#
9090
raiseExceptions = 1
9191

92+
#
93+
# If you don't want threading information in the log, set this to zero
94+
#
95+
logThreads = 1
96+
97+
#
98+
# If you don't want process information in the log, set this to zero
99+
#
100+
logProcesses = 1
101+
92102
#---------------------------------------------------------------------------
93103
# Level related stuff
94104
#---------------------------------------------------------------------------
@@ -243,13 +253,13 @@ def __init__(self, name, level, pathname, lineno,
243253
self.created = ct
244254
self.msecs = (ct - long(ct)) * 1000
245255
self.relativeCreated = (self.created - _startTime) * 1000
246-
if thread:
256+
if logThreads and thread:
247257
self.thread = thread.get_ident()
248258
self.threadName = threading.currentThread().getName()
249259
else:
250260
self.thread = None
251261
self.threadName = None
252-
if hasattr(os, 'getpid'):
262+
if logProcesses and hasattr(os, 'getpid'):
253263
self.process = os.getpid()
254264
else:
255265
self.process = None

0 commit comments

Comments
 (0)