def setup_logging():
"""Setup Google-style logging
From: https://github.com/twitter/commons/blob/master/src/python/twitter/common/log/formatters/glog.py
"""
fmt = '%(levelletter)s%(asctime)s.%(msecs).03d %(process)d %(filename)s:%(lineno)d] %(message)s'
datefmt= '%m%d %H:%M:%S'
formatter = CustomFormatter(fmt, datefmt)
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(formatter)
root = logging.getLogger()
root.setLevel(logging.DEBUG)
root.addHandler(console_handler)
return
def log_loading_messages(app, host, port):
log = logging.getLogger(__name__)
log.info('* Flask version: {}'.format(flask.__version__))
log.info('* DEBUG: {}'.format(app.config['DEBUG']))
return
app = create_app()
if __name__ == '__main__':
host = '127.0.0.1'
port = 5000
setup_logging()
log_loading_messages(app, host, port)
app.run(host, port)
I0728 11:51:25.131 27617 logging.py:39] * Flask version: 0.11.1
I0728 11:51:25.131 27617 logging.py:40] * DEBUG: True
I0728 11:51:25.153 27617 _internal.py:87] * Running on http://127.0.0.1:5000/
I0728 11:51:25.154 27617 _internal.py:87] * Restarting with stat
W0728 11:51:25.462 27618 _internal.py:87] * Debugger is active!
I0728 11:51:25.471 27618 _internal.py:87] * Debugger pin code: 867-67-3982