Is there a way of passing to the logger a formatted string with an end='\r' flag? Previously I used to have there a print() statement which I replaced with logging.info() but it stopped working now
import logging
logging.basicConfig(level=logging.DEBUG)
logging.info("Running operation ID: {0} on {1}. fl-queuetool -z {1} log {0}".format(str(oper_ID), zone))
while True:
stat = getOperationStatus(zone, oper_ID)
logging.info(stat, end='\r')
Terminal output:
INFO:root:Running operation ID: 6057 on star. fl-queuetool -z star log 6057
DEBUG:root:_log() got an unexpected keyword argument 'end'
Is there a way of fixing it? In the documentations it reads the function accepts *args...
logging.info(msg, *args, **kwargs)¶
Logs a message with level INFO on the root logger. The arguments are interpreted as for debug().
If you're using Python >= 3.2, you can set the terminator
attribute on a StreamHandler
to determine what the terminator is. It defaults to \n
, of course. See the documentation.