python3 - set '\n\n' as the terminator when writing a formatted LogRecord

Peter Otten __peter__ at web.de
Fri Dec 30 04:55:39 EST 2016


iMath wrote:

> Is it possible to set '\n\n' as the terminator when writing a formatted
> LogRecord to a stream by changing the format parameter of
> logging.basicConfig?
> 
> I know it is possible using the terminator attribute of StreamHandler
> class to implement this, I just wonder Is it possible to achieve this
> feature by changing the format parameter? I am not familiar with the
> format string language

How about altering an existing format?

>>> logging.basicConfig(format=logging.BASIC_FORMAT + "\n", 
level=logging.INFO)
>>> g = logging.getLogger()
>>> g.info("hi")
INFO:root:hi

>>> 




More information about the Python-list mailing list