This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Slightly wrong behavior of logging.StrFormatStyle.usesTime
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: etobis, r.david.murray, vinay.sajip
Priority: normal Keywords: patch

Created on 2013-02-13 04:47 by etobis, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mywork.patch etobis, 2013-02-13 04:49 review
Messages (4)
msg181992 - (view) Author: Enrique A Tobis (etobis) Date: 2013-02-13 04:47
import logging

f = logging.StrFormatStyle('{asctimer}')
print(f.usesTime())
f = logging.PercentStyle('%(astimer)s')
print(f.usesTime())

prints

True
False

and I think it should print

False
False
msg182035 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-02-13 14:28
It's not a bug - the reason it's like that is that it allows conversion and format specifiers to be given - {field_name!conversion:format_spec}.

Of course a more robust solution using regular expressions could be implemented, but it's not really worth it. If there's a misspelt field name, generally you'll know because there will either be an exception raised, or (in production) no output will be produced.
msg182036 - (view) Author: Enrique A Tobis (etobis) Date: 2013-02-13 14:31
Thanks! Got it. Sorry for the noise.
msg182037 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-02-13 14:33
I would still consider it a bug myself, but I understand and accept that you feel it is not worth fixing.
History
Date User Action Args
2022-04-11 14:57:41adminsetgithub: 61401
2013-02-13 14:33:35r.david.murraysetnosy: + r.david.murray
messages: + msg182037
2013-02-13 14:31:15etobissetmessages: + msg182036
2013-02-13 14:28:50vinay.sajipsetstatus: open -> closed
resolution: not a bug
messages: + msg182035
2013-02-13 12:02:25r.david.murraysettype: enhancement -> behavior
versions: + Python 3.2, Python 3.4
2013-02-13 12:01:23r.david.murraysetnosy: + vinay.sajip
2013-02-13 04:49:43etobissetfiles: + mywork.patch
keywords: + patch
2013-02-13 04:47:57etobiscreate