logger.setLevel(logging.INFO)

def log(message):
    print('{} {}'.format(datetime.datetime.now(), message))
logger.info(message)
setup_file_logger('out.log')
for i in range(10000):
    log('Doing hard work here i=' + str(i))
log('Taking a nap now...')
time.sleep(1000)
Closed IPython Notebook that was running code