Kaydet (Commit) 10914b74 authored tarafından Vinay Sajip's avatar Vinay Sajip

Issue #11330: asctime format bug fixed.

üst 725c2b98
...@@ -360,12 +360,13 @@ class PercentStyle(object): ...@@ -360,12 +360,13 @@ class PercentStyle(object):
default_format = '%(message)s' default_format = '%(message)s'
asctime_format = '%(asctime)s' asctime_format = '%(asctime)s'
asctime_search = '%(asctime)'
def __init__(self, fmt): def __init__(self, fmt):
self._fmt = fmt or self.default_format self._fmt = fmt or self.default_format
def usesTime(self): def usesTime(self):
return self._fmt.find(self.asctime_format) >= 0 return self._fmt.find(self.asctime_search) >= 0
def format(self, record): def format(self, record):
return self._fmt % record.__dict__ return self._fmt % record.__dict__
...@@ -373,6 +374,7 @@ class PercentStyle(object): ...@@ -373,6 +374,7 @@ class PercentStyle(object):
class StrFormatStyle(PercentStyle): class StrFormatStyle(PercentStyle):
default_format = '{message}' default_format = '{message}'
asctime_format = '{asctime}' asctime_format = '{asctime}'
asctime_search = '{asctime'
def format(self, record): def format(self, record):
return self._fmt.format(**record.__dict__) return self._fmt.format(**record.__dict__)
...@@ -381,6 +383,7 @@ class StrFormatStyle(PercentStyle): ...@@ -381,6 +383,7 @@ class StrFormatStyle(PercentStyle):
class StringTemplateStyle(PercentStyle): class StringTemplateStyle(PercentStyle):
default_format = '${message}' default_format = '${message}'
asctime_format = '${asctime}' asctime_format = '${asctime}'
asctime_search = '{asctime'
def __init__(self, fmt): def __init__(self, fmt):
self._fmt = fmt or self.default_format self._fmt = fmt or self.default_format
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment