]> granicus.if.org Git - python/commitdiff
Issue #11330: asctime format bug fixed.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 26 Feb 2011 14:15:48 +0000 (14:15 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 26 Feb 2011 14:15:48 +0000 (14:15 +0000)
Lib/logging/__init__.py

index e1c4a37b535bc9a91ba71e0cc7865d9568f9b094..d61699e035c2c3a21b4604ae3375a4145fd592b0 100644 (file)
@@ -360,12 +360,13 @@ class PercentStyle(object):
 
     default_format = '%(message)s'
     asctime_format = '%(asctime)s'
+    asctime_search = '%(asctime)'
 
     def __init__(self, fmt):
         self._fmt = fmt or self.default_format
 
     def usesTime(self):
-        return self._fmt.find(self.asctime_format) >= 0
+        return self._fmt.find(self.asctime_search) >= 0
 
     def format(self, record):
         return self._fmt % record.__dict__
@@ -373,6 +374,7 @@ class PercentStyle(object):
 class StrFormatStyle(PercentStyle):
     default_format = '{message}'
     asctime_format = '{asctime}'
+    asctime_search = '{asctime'
 
     def format(self, record):
         return self._fmt.format(**record.__dict__)
@@ -381,6 +383,7 @@ class StrFormatStyle(PercentStyle):
 class StringTemplateStyle(PercentStyle):
     default_format = '${message}'
     asctime_format = '${asctime}'
+    asctime_search = '{asctime'
 
     def __init__(self, fmt):
         self._fmt = fmt or self.default_format