logger = logging.getLogger('test')
logger.setLevel(logging.DEBUG)
logger.addHandler(progress)
logger.info('test1')
for i in range(3):
    logger.info('remaining %d seconds', i, extra={'same_line': True})
time.sleep(1)
logger.info('test2')
How to write custom python logging handler?