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

Skip to content

Commit 10914b7

Browse files
committed
Issue #11330: asctime format bug fixed.
1 parent 725c2b9 commit 10914b7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/logging/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,19 +360,21 @@ class PercentStyle(object):
360360

361361
default_format = '%(message)s'
362362
asctime_format = '%(asctime)s'
363+
asctime_search = '%(asctime)'
363364

364365
def __init__(self, fmt):
365366
self._fmt = fmt or self.default_format
366367

367368
def usesTime(self):
368-
return self._fmt.find(self.asctime_format) >= 0
369+
return self._fmt.find(self.asctime_search) >= 0
369370

370371
def format(self, record):
371372
return self._fmt % record.__dict__
372373

373374
class StrFormatStyle(PercentStyle):
374375
default_format = '{message}'
375376
asctime_format = '{asctime}'
377+
asctime_search = '{asctime'
376378

377379
def format(self, record):
378380
return self._fmt.format(**record.__dict__)
@@ -381,6 +383,7 @@ def format(self, record):
381383
class StringTemplateStyle(PercentStyle):
382384
default_format = '${message}'
383385
asctime_format = '${asctime}'
386+
asctime_search = '{asctime'
384387

385388
def __init__(self, fmt):
386389
self._fmt = fmt or self.default_format

0 commit comments

Comments
 (0)