[Python-checkins] python/dist/src/Lib/logging __init__.py, 1.31, 1.32
vsajip@users.sourceforge.net
vsajip at users.sourceforge.net
Fri Oct 14 11:36:39 CEST 2005
Update of /cvsroot/python/python/dist/src/Lib/logging
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19520
Modified Files:
__init__.py
Log Message:
Optimised Placeholders handling of child loggers by using a dict rather than a list (much slower in the pathological case of hundreds of child Loggers to a Placeholder - problem reported by Ryan Blazecka).
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- __init__.py 7 Oct 2005 08:35:36 -0000 1.31
+++ __init__.py 14 Oct 2005 09:36:35 -0000 1.32
@@ -783,14 +783,17 @@
"""
Initialize with the specified logger being a child of this placeholder.
"""
- self.loggers = [alogger]
+ #self.loggers = [alogger]
+ self.loggerMap = { alogger : None }
def append(self, alogger):
"""
Add the specified logger as a child of this placeholder.
"""
- if alogger not in self.loggers:
- self.loggers.append(alogger)
+ #if alogger not in self.loggers:
+ if not self.loggerMap.has_key(alogger):
+ #self.loggers.append(alogger)
+ self.loggerMap[alogger] = None
#
# Determine which class to use when instantiating loggers.
@@ -892,7 +895,8 @@
Ensure that children of the placeholder ph are connected to the
specified logger.
"""
- for c in ph.loggers:
+ #for c in ph.loggers:
+ for c in ph.loggerMap.keys():
if string.find(c.parent.name, alogger.name) <> 0:
alogger.parent = c.parent
c.parent = alogger
More information about the Python-checkins
mailing list