logging.LogRecord asctime aattribute - easily override somehow?

Peter Otten __peter__ at web.de
Wed Mar 29 12:39:59 EDT 2017


Skip Montanaro wrote:

> Short of going into some Formatter creation exercise (which seems like
> overkill to me, and somewhat obscure), is there some way to easily
> change the format of the logging.LogRecord's asctime attribute?
> 
> Thx,
> 
> Skip

Like

>>> import logging
>>> logging.basicConfig(format="%(asctime)s" + logging.BASIC_FORMAT, 
datefmt="***%A***")
>>> logging.warn("foo")
***Wednesday***WARNING:root:foo

?



More information about the Python-list mailing list