Issue 17199: Slightly wrong behavior of logging.StrFormatStyle.usesTime (original) (raw)

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:41 admin set github: 61401
2013-02-13 14:33:35 r.david.murray set nosy: + r.david.murraymessages: +
2013-02-13 14:31:15 etobis set messages: +
2013-02-13 14:28:50 vinay.sajip set status: open -> closedresolution: not a bugmessages: +
2013-02-13 12:02:25 r.david.murray set type: enhancement -> behaviorversions: + Python 3.2, Python 3.4
2013-02-13 12:01:23 r.david.murray set nosy: + vinay.sajip
2013-02-13 04:49:43 etobis set files: + mywork.patchkeywords: + patch
2013-02-13 04:47:57 etobis create