Last active
December 16, 2016 14:19
-
-
Save dzerrenner/7704195 to your computer and use it in GitHub Desktop.
Use chromelogger with Flask
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
# custom response handler for flask and chromelogger | |
# use chromelogger to log directly to the chorme development console | |
# (see: https://github.com/ccampbell/chromelogger-python) | |
# | |
# put this in your application config | |
if app.debug: | |
import chromelogger as console | |
@app.after_request | |
def chromelogger(response): | |
header = console.get_header() | |
if header is not None: | |
response.headers.add(*header) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the snipper !