Created
December 17, 2015 11:12
-
-
Save bigkevmcd/7d2d24adf327ff2aba86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from logging.handlers import SysLogHandler | |
# $ python hello.py | |
# * Restarting with stat | |
# * Debugger is active! | |
# -------------------------------------------------------------------------------- | |
# INFO in hello [hello.py:9]: | |
# Getting / in the Hello flask app | |
# -------------------------------------------------------------------------------- | |
# 127.0.0.1 - - [17/Dec/2015 11:10:41] "GET / HTTP/1.1" 200 - | |
# and logged to syslog... | |
# Dec 17 11:10:38 Getting / in the Hello flask app | |
app = Flask(__name__) | |
app.logger.addHandler(SysLogHandler(('192.168.0.254', 514))) | |
@app.route('/') | |
def index(): | |
app.logger.info("Getting / in the Hello flask app") | |
return '<h1>Hello World!</h1>' | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment