]> granicus.if.org Git - python/commitdiff
Backported changes from trunk:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 8 Jan 2007 10:12:29 +0000 (10:12 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 8 Jan 2007 10:12:29 +0000 (10:12 +0000)
Made func argument in LogRecord.__init__ optional.
Improved performance of _fixupChildren.

Lib/logging/__init__.py

index dc3400d00dd9eeb95af9fb3336a0fab73528b3b3..c72730843e46af01e1c7e94a8f671a43c8f401a8 100644 (file)
@@ -214,7 +214,7 @@ class LogRecord:
     information to be logged.
     """
     def __init__(self, name, level, pathname, lineno,
-                 msg, args, exc_info, func):
+                 msg, args, exc_info, func=None):
         """
         Initialize a logging record with interesting information.
         """
@@ -910,9 +910,12 @@ class Manager:
         Ensure that children of the placeholder ph are connected to the
         specified logger.
         """
-        #for c in ph.loggers:
+        name = alogger.name
+        namelen = len(name)
         for c in ph.loggerMap.keys():
-            if string.find(c.parent.name, alogger.name) <> 0:
+            #The if means ... if not c.parent.name.startswith(nm)
+            #if string.find(c.parent.name, nm) <> 0:
+            if c.parent.name[:namelen] != name:
                 alogger.parent = c.parent
                 c.parent = alogger