Created
October 19, 2015 16:24
-
-
Save alexrutherford/2e55a3ddba7642489203 to your computer and use it in GitHub Desktop.
Snippet to add logging with timestamps to Flask app
This file contains hidden or 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
| import logging | |
| hdlr = logging.FileHandler('log.log') | |
| formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
| hdlr.setFormatter(formatter) | |
| app = Flask(__name__) | |
| app.debug=True | |
| app.logger.addHandler(hdlr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment