Flask Logging
Log to a file
import logging
from logging import Formatter
from logging.handlers import RotatingFileHandler
handler = RotatingFileHandler('weather.log', maxBytes=100000, backupCount=5)
handler.setLevel(logging.INFO)
handler.setFormatter(Formatter('%(asctime)s %(levelname)s: %(message)s [in %(module)s - %(funcName)s:%(lineno)d]'))
app.logger.addHandler(handler)
Add log info and debug
app.logger.info('Begin to insert current weather:{}'.format(current['location']))
app.logger.debug('current basic weather:{}'.format(basic))