Let's say I have a logging setup like this in my Python script:
import logging
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout,
format='%(asctime)s %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S')
logging.info('info')
logging.error('error...')
logging.debug('debug...')
Is there a way I can have it wait to print to stdout until the script is finished running and sort the log messages by level before printing?